php problem
| From: | Aaron Downes | Date: | Wed, 05 Feb 2003 04:44:00 +0000 |
| Subject: | php problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-134366@lists.php.net to get a copy of this message | ||
Dear Sir/Madam,
trying to displaying records by php get error :
Parse error: parse error in /hsphere/local/home/ozhomene/ardownes.com/ViewContacts.php on line 30
see below for code for ViewContacts.php :
<html>
<body>
<?
$connection=mysql_connect("localhost","",""); #am entering userID
&password instead of ,"","")
IF (!$connection) {
echo "Could not connect to mySQL server";
exit;
}
$db=mysql_select_db("test_holding",$connection);
if (!$db) {
echo "Could not change the database";
exit;
}
#sql="SELECT * FROM contacts"; # name of table "contacts" with below
fields
#mysql_result=mysql_query($sql,$connection);
$num_rows=mysql_num_rows($mysql_result);
if ( $num_rows == 0 ) {
echo "Sorry, there is no information.";
} else {
#we have results
while ($rows=mysql_fetch_array($mysql_result)) {
$ID=row['ID']; # this is
line 30
$first_name=row['first_name'];
$surname=row['surname'];
$email=row['email'];
$comments=row['comments'];
# display results
echo "$fist_name : $surname $email $comments<br>";
}
} # end else
mysql_close($connection);
?>
</body>
</html>
Any help will be appreciated.
Best regards,
Aaron Downes