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',$use rname,$password );
$query="select * from contacts where id='$id'";
$result="mysql_ query($query)";
$num="mysql_num rows($result)";
$i=0;
while($i < $num){
$first=mysql_re sult($result,$i ,"first");
$last=mysql_res ult($result,$i, "last");
$phone=mysql_re sult($result,$i ,"phone");
$mobile=mysql_r esult($result,$ i,"mobile");
$fax=mysql_resu lt($result,$i," fax");
$email=mysql_re sult($result,$i ,"email");
$web=mysql_resu lt($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!
[PHP]
<html>
<head>
</head>
<body>
<?php
$id='$_GET[id]';
$username="**** **";
$password="**** **";
$database="**** **";
mysql_connect(' localhost',$use rname,$password );
$query="select * from contacts where id='$id'";
$result="mysql_ query($query)";
$num="mysql_num rows($result)";
$i=0;
while($i < $num){
$first=mysql_re sult($result,$i ,"first");
$last=mysql_res ult($result,$i, "last");
$phone=mysql_re sult($result,$i ,"phone");
$mobile=mysql_r esult($result,$ i,"mobile");
$fax=mysql_resu lt($result,$i," fax");
$email=mysql_re sult($result,$i ,"email");
$web=mysql_resu lt($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!
Comment