I need help here, I am trying to learn PHP and MySQL and have run into some trouble. I have written this page to update records in my database, and cannot get the page to load. It just comes up a blank page. All the other paged I have written come up fine. I have fixed all the errors in my error.log, so what am I doing wrong here? The code is:
[PHP]
<html>
<head>
</head>
<body>
<?php
$id='$_GET[id]';
$username="******";
$password="******";
$database="******";
mysql_connect('localhost',$username,$password);
$query="select * from contacts where id='$id'";
$result="mysql_query($query)";
$num="mysql_numrows($result)";
$i=0;
while($i < $num){
$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$phone=mysql_result($result,$i,"phone");
$mobile=mysql_result($result,$i,"mobile");
$fax=mysql_result($result,$i,"fax");
$email=mysql_result($result,$i,"email");
$web=mysql_result($result,$i,"web");
mysql_close();
?>
<form action="update.php" method="post">
<input type="hidden" name="ud_id" value="<?php echo $id; ?>">
First Name: <input type="text" name="ud_first" value="<?php echo $first; ?>"><br>
Last Name: <input type="text" name="ud_last" value="<?php echo $last; ?>"><br>
Phone Number: <input type="text" name="ud_phone" value="<?php echo $phone; ?>"><br>
Mobile Number: <input type="text" name="ud_mobile" value="<?php echo $mobile; ?>"><br>
Fax Number: <input type="text" name="ud_fax" value="<?php echo $fax; ?>"><br>
E-mail Address: <input type="text" name="ud_email" value="<?php echo $email; ?>"><br>
Web Address: <input type="text" name="ud_web" value="<?php echo $web; ?>"><br>
<input type="Submit" value="Update">
<?php
++$i;
}
?>
</body>
</html>
[/PHP]
Don't laugh too hard, its just thrown together because I am trying to learn. :)
Thanks for any help in advance!