--- Jigal van Hemert <[EMAIL PROTECTED]> wrote:
 
> If you need to know how to display the resulting
> record sets, example 1 on:
> http://www.php.net/manual/en/ref.mysql.php
> gives you a complete piece of code to print out the
> resulting records.

OK, I think this example points out what I'm doing
wrong, even if I still don't get it.

Here's the top portion of my code, which was primarily
inserted by Dreamweaver:

[PHP]
<?php
require_once('../../../../Connections/World.php'); ?>
<?php
mysql_select_db($database_World, $World);
$query_Continents = "SELECT * FROM continents";
$Continents = mysql_query($query_Continents, $World)
or die(mysql_error());
$row_Continents = mysql_fetch_assoc($Continents);
$totalRows_Continents = mysql_num_rows($Continents);
?>
<!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]

This is what's listed in the example:

[PHP]
<?php
/* Connecting, selecting database */
$link = mysql_connect("mysql_host", "mysql_user",
"mysql_password")
   or die("Could not connect : " . mysql_error());
echo "Connected successfully";
mysql_select_db("my_database") or die("Could not
select database");

/* Performing SQL query */
$query = "SELECT * FROM my_table";
$result = mysql_query($query) or die("Query failed : "
. mysql_error());
[/PHP]

So I need to transform my code into something that
more closely resembles the code above?

The table I use to display my tables is the most
confusing thing of all. Tutorials focus on query and
select statements, and don't mention the display
tables. If I make a query/select statement that calls
up three columns from table Continents and two columns
Nations, then I assume my dynamic table has to be set
up to display three columns from Continents and two
columns from Nations, also. But how do you mention two
MySQL tables in one dynamic table?

Anyway, this is the table I'm using:

[PHP]
<table class="sortable" id="tabnat" cellspacing="0">
            <thead>
              <tr class="rowheader">
                <th>Name1</th>
                <th>Type1</th>
                <th>Group</th>
                <th>Hemisphere</th>
                <th>ID</th>
                <th>NameN</th>
              </tr>
            </thead>
            <tbody>
              <?php do { ?>
              <tr>
<td class="name"><?php echo $row_Continents['Name1'];
?></td>
<td class="type"><?php echo $row_Continents['Type1'];
?></td>
<td class="name"><?php echo $row_Continents['Group'];
?></td>
<td class="name"><?php echo
$row_Continents['Hemisphere']; ?></td>
<td><?php echo $row_Continents['CCode']; ?></td>
<td class="name"><?php echo $row_Nations['NamesN'];
?></td>
   </tr>
  </tbody>
<?php } while ($row_Continents =
mysql_fetch_assoc($Continents)); ?>
 </table>
[/PHP]

But the example lists a formula for "printing
results," which I assume means displaying data (not
printing it out on paper):

[PHP]
/* Printing results in HTML */
echo "<table>\n";
while ($line = mysql_fetch_array($result,
MYSQL_ASSOC)) {
   echo "\t<tr>\n";
   foreach ($line as $col_value) {
       echo "\t\t<td>$col_value</td>\n";
   }
   echo "\t</tr>\n";
}
echo "</table>\n";
[/PHP]

And do I just insert that as it is? I put a picture of
what it looks like (just above my dynamic table) at
http://www.geoworld.org/joinex.gif It looks just the
same if I take out my dynamic table.

So I suspect this would all make more sense if I had
never begun with Dreamweaver. Some people say
Dreamweaver doesn't bloat the code that much, but it
sure doesn't resemble the example you showed me!



        
                
__________________________________
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to