Jump to content


Help with one step of outside tutorial...


  • Please log in to reply
2 replies to this topic

#1 Guest_kilbad_*

Guest_kilbad_*
  • Guests

Posted 03 August 2006 - 01:42 AM

I have been doing this tutorial at freewebmasterhelp.com.  However, while I understand the logic of the seventh tutorial page (http://www.freewebma...ials/phpmysql/7), I am getting errors when I write up the scripts it describes.

Could someone help me... specifically, I need the full code to the couple of scripts described on that page (for Updating & Deleting database entries)?  I just cannot seem to get them right like I did pages 1-6.  ???

Regardless, thank you for your time and consideration!

Brendan

#2 extrovertive

extrovertive
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 03 August 2006 - 09:09 AM

well, what have you wrote?

#3 Guest_kilbad_*

Guest_kilbad_*
  • Guests

Posted 03 August 2006 - 01:55 PM

<?php

$id=$_GET['id'];
$username="username";
$password="password";
$database="your_database";
mysql_connect(localhost,$username,$password);

$query=" SELECT * FROM contacts WHERE id='$id'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();

$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");


<form action="updated.php" method="post">
<input type="hidden" name="ud_id" value="<? echo $id; ?>">
First Name: <input type="text" name="ud_first" value="<? echo $first; ?>"><br>
Last Name: <input type="text" name="ud_last" value="<? echo $last; ?>"><br>
Phone Number: <input type="text" name="ud_phone" value="<? echo $phone; ?>"><br>
Mobile Number: <input type="text" name="ud_mobile" value="<? echo $mobile; ?>"><br>
Fax Number: <input type="text" name="ud_fax" value="<? echo $fax; ?>"><br>
E-mail Address: <input type="text" name="ud_email" value="<? echo $email; ?>"><br>
Web Address: <input type="text" name="ud_web" value="<? echo $web; ?>"><br>
<input type="Submit" value="Update">
</form>

++$i;
}


?>







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users