Hi there,
Another problem I'm having is longer scripts seem to stop loading as scripts and start loading on the page. E.g the output of this:
<html>
<head></head>
<body>
<?php
// open connection to MySQL server
$connection = mysql_connect('localhost', 'user', 'pass') or die ('Unable to connect!');
// select database for use
mysql_select_db('orders') or die ('Unable to select database!');
// create and execte query
$query = 'SELECT * FROM items';
$result = mysql_query($query)
or die ('Error in query: $query. ' . mysql_error());
// check if record were returned
if (mysql_num_rows($result) > 0)
{
// print HTML table
echo '<table width=100% cellpadding=10 cellspacing=0 border=1>';
echo '<tr><td><b>ID</b></td><td><b>Name</b></td><td><b>Price</b></td></tr>';
// iterate over record set
// print each field
while($row = mysql_fetch_row($result))
{
echo '<tr>';
echo '<td>' . $row[0] . '</td>';
echo '<td>' . $row[1] . '</td>';
echo '<td>' . $row[2] . '</td>';
echo '</tr>';
}
echo '</table>';
}
else
{
// print error message
echo 'No rows found!';
}
// once processing is complete
// free result set
mysql_free_result($result);
// close connection to MySQL server
mysql_close($connection);
?>
</body>
</html>
comes out as this on the web browser:
0) { // print HTML table echo ''; // iterate over record set // print each field while($row = mysql_fetch_row($result)) { echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
'; echo '
ID Name Price
' . $row[0] . ' ' . $row[1] . ' ' . $row[2] . '
'; } else { // print error message echo 'No rows found!'; } // once processing is complete // free result set mysql_free_result($result); // close connection to MySQL server mysql_close($connection); ?>
If anybody has any ideas atall - please help!
Thanks
Edd