colleyboy Posted July 6, 2010 Share Posted July 6, 2010 Hi there, I am new here but am in need of help. I am writing a basic script so that i can input data on one page into the table. View it on another page... edit the info on another page... and delete info on another page... and search for info on another page. I am doing ok so far. I have sorted a page to add info into my mysql table fine. And to view it in table form... fine. When I have written the modify page... I do not seem to have anything coming up? Can someone help please? Update.php: <? $id=$_GET['id']; include("dbinfo.inc.php"); mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $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"> <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; } ?> updated.php: <? include("dbinfo.inc.php"); mysql_connect(localhost,$username,$password); $query="UPDATE contacts SET first='$ud_first', last='$ud_last', phone='$ud_phone', mobile='$ud_mobile', fax='$ud_fax', email='$ud_email', web='$ud_web' WHERE id='$ud_id'"; @mysql_select_db($database) or die( "Unable to select database"); mysql_query($query); echo "Record Updated"; mysql_close(); ?> Link to comment https://forums.phpfreaks.com/topic/206924-simple-php-problem-somebody-help-me-plz-d/ Share on other sites More sharing options...
colleyboy Posted July 6, 2010 Author Share Posted July 6, 2010 Dont worry.. its ok: worked out I made it think ID's... so it is a URL extension.. idiot! Link to comment https://forums.phpfreaks.com/topic/206924-simple-php-problem-somebody-help-me-plz-d/#findComment-1082113 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.