[PHP] strange echo() effect From: Mat Harris (mat.harris <email protected>)
Date: 10/31/02

I have a small piece of code which does the following:

1) call a function to print an html header,
2) query a database to list the users in the db,
3) print an html footer.

problem is it print out the footer before the table, even though it is
called after. looking at the html source of the page in a browser, show that
the table is first, why is this happening? here is the code:

html_header();
echo "<table border=\"1\" width=\"80%\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "<tr>\n";
echo "<td><b>uid</b></td>\n";
echo "<td><b>username</b></td>\n";
echo "<td><b>password</b></td>\n";
echo "<td><b>session id</b></td>\n";
echo "<td><b>email address</b></td>\n";
echo "</tr>\n";
$query = "SELECT * FROM users LIMIT 0,30";
$result = mysql_query($query);
while ($query_data = mysql_fetch_row($result))
        {
        echo "<tr>\n";
        foreach ($query_data As $column)
                {
                echo "\t<td>$column</td>\n";
                }
        echo "</tr>\n";
        }
echo "<br><br>\n";
html_footer();

-- 
Mat Harris			OpenGPG Public Key ID: C37D57D9
mat.harris <email protected>	matthewh.genestate.com	

  • application/pgp-signature attachment: stored