Evad
05-09-2004, 05:39 AM
My first question is extremely simple, and I suspect the second one isn't too tough, either. I'm a newbie; I've been working with webpages driven by PHP includes and echo functions and am just learning how to create MySQL tables, connect them with Dreamweaver and display them on web pages.
Below is the code from the head section of one of my pages:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<?php
$seg = '../../../';
$myname = 'France';
$mycode = 'fr';
$iso3 = 'fra';
$ison = '250';
$fips = '' . $mycode . '';
$internet = '' . $mycode . '';
$mynat = '' . $myname . '';
$nat = '' . $mycode . '';
$mycont = 'Eurasia (Europe)';
$cont = 'eurasia';
$contlink = '<a href="../index.php">' . $mycont . '</a> > ';
$mysec = 'World';
$sec = 'world';
$seclink = '<a href="../../index.php">' . $mysec . '</a> > ';
$url = '' . ((!empty($sec)) ? ($sec . '/') : '') . ((!empty($cont)) ? ($cont . '/') : '') . ((!empty($nat)) ? ($nat . '/') : '') . ((!empty($state)) ? ($state . '/') : '');
$urlworld = '' . ((!empty($cont)) ? ($cont . '/') : '') . ((!empty($nat)) ? ($nat . '/') : '') . ((!empty($state)) ? ($state . '/') : '');
$myreg = 'Western Europe';
$reg = 'Western Europe';
$reg2 = ', <a href="http://www.geoworld.org/' . $contcode . '/regions/index.php#alps">Alps</a>';
$nick = 'The Cultured Empire';
$quote = 'I don’t know exactly what democracy is. But we need more of it.';
$sig = 'Anonymous Chinese Student, during protests in Tianamen Square, Beijing, 1989';
include ($seg."a1/inc/head.php")
?>
</head>
I don't yet understand how all this stuff works, but if I'm going to make a database driven site, then I assume I'm going to be replacing my includes and echo statements with databases. Right now, I'm deseperately trying to figure out how to take the first step. "The Manual" is useless, because I don't even know where to begin; I don't know what topic to research.
So let me reduce the above head section to a single element:
$myname = 'France';
On another page, that would be...
$myname = 'Spain';
Now, suppose I have a database table that lists every county, its capital, population, etc. Suppose "Spain" is in the 52nd row, 2nd column. How do I replace $myname = 'Spain'; with the cell from the 52nd row, 2nd column?
What would the replacement look like - something like this?:
$myname = '$row_Recordset1['Country']';
I became even more confused when I inserted a "dynamic," repeating table with Dreamweaver. Here's what it looks like:
<table border="1">
<tr>
<td>Name</td>
<td>Capital</td>
<td>Birthday</td>
<td>Rank</td>
<td>Origin</td>
<td>Code</td>
<td>Country</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_Recordset1['Name']; ?></td>
<td><?php echo $row_Recordset1['Capital']; ?></td>
<td><?php echo $row_Recordset1['Birthday']; ?></td>
<td><?php echo $row_Recordset1['Rank']; ?></td>
<td><?php echo $row_Recordset1['Origin']; ?></td>
<td><?php echo $row_Recordset1['Code']; ?></td>
<td><?php echo $row_Recordset1['Country']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
As you can see, it doesn't really illustrate the entire table, though I can see the entire table when I preview the page in a browser. So do I just have to look at the original table, count the rows and columns and figure out the coordinates of the cell that contains the word "Spain"?
My second question is more complex. Here's another condensed view of the head section. Notice that it matches France with a Continent (Europe) and Section (World).
<head>
<?php
$seg = '../../../';
$myname = 'France';
$mycode = 'fr';
$mynat = '' . $myname . '';
$nat = '' . $mycode . '';
$mycont = 'Eurasia (Europe)';
$cont = 'eurasia';
$contlink = '<a href="../index.php">' . $mycont . '</a> > ';
$mysec = 'World';
$sec = 'world';
include ($seg."a1/inc/head.php")
?>
</head>
So, my first hunch was that I'd replace $myname = 'France'; with a cell from my database table, replace $mycont = 'Eurasia (Europe)'; with another cell, and so on.
But can I set it up so that all I have to is insert ONE cell that identifies this page as "France," and it will somehow magically pull everything associated with it along? In other words, if that single cell says, "This is France," then an element that's programmed to display the name of a continent will say, "This is Europe!"
I hope my explanation wasn't too scattered, but I suspect this is a fairly easy operation. I just wallowing in confusion at the moment.
Thanks!
Below is the code from the head section of one of my pages:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<?php
$seg = '../../../';
$myname = 'France';
$mycode = 'fr';
$iso3 = 'fra';
$ison = '250';
$fips = '' . $mycode . '';
$internet = '' . $mycode . '';
$mynat = '' . $myname . '';
$nat = '' . $mycode . '';
$mycont = 'Eurasia (Europe)';
$cont = 'eurasia';
$contlink = '<a href="../index.php">' . $mycont . '</a> > ';
$mysec = 'World';
$sec = 'world';
$seclink = '<a href="../../index.php">' . $mysec . '</a> > ';
$url = '' . ((!empty($sec)) ? ($sec . '/') : '') . ((!empty($cont)) ? ($cont . '/') : '') . ((!empty($nat)) ? ($nat . '/') : '') . ((!empty($state)) ? ($state . '/') : '');
$urlworld = '' . ((!empty($cont)) ? ($cont . '/') : '') . ((!empty($nat)) ? ($nat . '/') : '') . ((!empty($state)) ? ($state . '/') : '');
$myreg = 'Western Europe';
$reg = 'Western Europe';
$reg2 = ', <a href="http://www.geoworld.org/' . $contcode . '/regions/index.php#alps">Alps</a>';
$nick = 'The Cultured Empire';
$quote = 'I don’t know exactly what democracy is. But we need more of it.';
$sig = 'Anonymous Chinese Student, during protests in Tianamen Square, Beijing, 1989';
include ($seg."a1/inc/head.php")
?>
</head>
I don't yet understand how all this stuff works, but if I'm going to make a database driven site, then I assume I'm going to be replacing my includes and echo statements with databases. Right now, I'm deseperately trying to figure out how to take the first step. "The Manual" is useless, because I don't even know where to begin; I don't know what topic to research.
So let me reduce the above head section to a single element:
$myname = 'France';
On another page, that would be...
$myname = 'Spain';
Now, suppose I have a database table that lists every county, its capital, population, etc. Suppose "Spain" is in the 52nd row, 2nd column. How do I replace $myname = 'Spain'; with the cell from the 52nd row, 2nd column?
What would the replacement look like - something like this?:
$myname = '$row_Recordset1['Country']';
I became even more confused when I inserted a "dynamic," repeating table with Dreamweaver. Here's what it looks like:
<table border="1">
<tr>
<td>Name</td>
<td>Capital</td>
<td>Birthday</td>
<td>Rank</td>
<td>Origin</td>
<td>Code</td>
<td>Country</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_Recordset1['Name']; ?></td>
<td><?php echo $row_Recordset1['Capital']; ?></td>
<td><?php echo $row_Recordset1['Birthday']; ?></td>
<td><?php echo $row_Recordset1['Rank']; ?></td>
<td><?php echo $row_Recordset1['Origin']; ?></td>
<td><?php echo $row_Recordset1['Code']; ?></td>
<td><?php echo $row_Recordset1['Country']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
As you can see, it doesn't really illustrate the entire table, though I can see the entire table when I preview the page in a browser. So do I just have to look at the original table, count the rows and columns and figure out the coordinates of the cell that contains the word "Spain"?
My second question is more complex. Here's another condensed view of the head section. Notice that it matches France with a Continent (Europe) and Section (World).
<head>
<?php
$seg = '../../../';
$myname = 'France';
$mycode = 'fr';
$mynat = '' . $myname . '';
$nat = '' . $mycode . '';
$mycont = 'Eurasia (Europe)';
$cont = 'eurasia';
$contlink = '<a href="../index.php">' . $mycont . '</a> > ';
$mysec = 'World';
$sec = 'world';
include ($seg."a1/inc/head.php")
?>
</head>
So, my first hunch was that I'd replace $myname = 'France'; with a cell from my database table, replace $mycont = 'Eurasia (Europe)'; with another cell, and so on.
But can I set it up so that all I have to is insert ONE cell that identifies this page as "France," and it will somehow magically pull everything associated with it along? In other words, if that single cell says, "This is France," then an element that's programmed to display the name of a continent will say, "This is Europe!"
I hope my explanation wasn't too scattered, but I suspect this is a fairly easy operation. I just wallowing in confusion at the moment.
Thanks!