I'm just learning MySQL & PHP and have been given this code to get a status report on the mysql database on my server. Line 17 (indicated with ***THIS LINE*** below)keeps getting rejected but as I'm new to this I can't figure out why. (PHP version is 4.3.3) Can anyone help?
<html>
<head>
<title>Test MySQL</title>
<body>
<!-- mysql_up.php -->
<?php
$host="localhost";
$user="xxx";
$password="xxx";
mysql_connect($host,$user,$password);
$sql="show status";
$result = mysql_query($sql);
if ($result == 0)
echo("<b>Error " . mysql_errno() . ": " . mysql_error() . "</b>);
elseif (mysql_num_rows($result) == 0)
***THIS LINE***echo("<b>Query executed successfully!</b>" ***THIS LINE***
else
{
?>
<!-- Table that displays the results -->
<table border="1">
<tr><td><b>Variable_name</b></td><td><b>Value</b></td></tr>
<?php
for ($i = 0; $i < mysql_num_rows($result); $i++ {
echo("<TR>"
$row_array = mysql_fetch_row($result);
for ($j = 0; $j < mysql_num_fields($result); $j++) {
echo("<TD>" . $row_array[$j] . "</td>"
}
echo("</tr>"
}
?>
</table>
<?php } ?>
<!-- ZoneLabs Popup Blocking Insertion -->
<script language='javascript'>postamble();</script>
<!-- ZoneLabs Popup Blocking Insertion -->
<script language='javascript'>postamble();</script>
</body>
</html>
<html>
<head>
<title>Test MySQL</title>
<body>
<!-- mysql_up.php -->
<?php
$host="localhost";
$user="xxx";
$password="xxx";
mysql_connect($host,$user,$password);
$sql="show status";
$result = mysql_query($sql);
if ($result == 0)
echo("<b>Error " . mysql_errno() . ": " . mysql_error() . "</b>);
elseif (mysql_num_rows($result) == 0)
***THIS LINE***echo("<b>Query executed successfully!</b>" ***THIS LINE***
else
{
?>
<!-- Table that displays the results -->
<table border="1">
<tr><td><b>Variable_name</b></td><td><b>Value</b></td></tr>
<?php
for ($i = 0; $i < mysql_num_rows($result); $i++ {
echo("<TR>"
$row_array = mysql_fetch_row($result);
for ($j = 0; $j < mysql_num_fields($result); $j++) {
echo("<TD>" . $row_array[$j] . "</td>"
}
echo("</tr>"
}
?>
</table>
<?php } ?>
<!-- ZoneLabs Popup Blocking Insertion -->
<script language='javascript'>postamble();</script>
<!-- ZoneLabs Popup Blocking Insertion -->
<script language='javascript'>postamble();</script>
</body>
</html>