NickG21 Posted March 5, 2007 Share Posted March 5, 2007 hey everyone, im fairly new to the incorporation of php and mySQL and i am looking to start off by making a user info database that will hold contact information as well as a username and password field. below is the code for the site i want to use to allow the user to "update" their info. My problem is when i click the link to "edit" info after the user has logged in, the page displays blank. here is my code, any help is much appreciated. thanks in advance. <?php include("dbinfo.inc.php"); mysql_connect($host,$dbusername,$dbpassword); @mysql_select_db($database) or die( "Unable to select database"); $query= "SELECT * FROM ContactInfo WHERE username='$user'"; $result= mysql_query($query); $num = mysql_num_rows($result); mysql_close(); $i=0; while ($i < $num) { $first=mysql_result($result,$i,"ud_first"); $last=mysql_result($result,$i,"ud_last"); $address=mysql_result($result,$i,"ud_address"); $city=mysql_result($result,$i,"ud_city"); $state=mysql_result($result,$i,"ud_state"); $zip=mysql_result($result,$i,"ud_zip"); $country=mysql_result($result,$i,"ud_country"); $email=mysql_result($result,$i,"ud_email"); $phone=mysql_result($result,$i,"ud_phone"); $fax=mysql_result($result,$i,"ud_fax"); ?> <form action="update.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> Address: <input type="text" name="ud_address" value="<? echo "$address"?>"><br> City: <input type="text" name="ud_city" value="<? echo "$city"?>"><br> State: <input type="text" name="ud_state" value="<? echo "$state"?>"><br> Zip: <input type="text" name="ud_zip" value="<? echo "$zip"?>"><br> Country: <input type="text" name="ud_country" value="<? echo "$country"?>"><br> E-mail: <input type="text" name="ud_email" value="<? echo "$email"?>"><br> Phone Number: <input type="text" name="ud_phone" value="<? echo "$phone"?>"><br> Fax Number: <input type="text" name="ud_fax" value="<? echo "$fax"?>"><br> <input type="Submit" value="Update"> </form> <? $i++; } ?> Link to comment https://forums.phpfreaks.com/topic/41315-updating-user-information-phpmysql/ Share on other sites More sharing options...
karthikeyan_coder Posted March 5, 2007 Share Posted March 5, 2007 <? $i++; } ?> make sure that your php supports short tags... <? .. ?> make the below setting on in your php.ini and restart your webserver. short_open_tag = On Link to comment https://forums.phpfreaks.com/topic/41315-updating-user-information-phpmysql/#findComment-200175 Share on other sites More sharing options...
NickG21 Posted March 5, 2007 Author Share Posted March 5, 2007 it says that the short_open_tag is on but thanks for the idea Link to comment https://forums.phpfreaks.com/topic/41315-updating-user-information-phpmysql/#findComment-200178 Share on other sites More sharing options...
boo_lolly Posted March 5, 2007 Share Posted March 5, 2007 where's update.php? Link to comment https://forums.phpfreaks.com/topic/41315-updating-user-information-phpmysql/#findComment-200181 Share on other sites More sharing options...
NickG21 Posted March 5, 2007 Author Share Posted March 5, 2007 that is the code for update.php? is this terribly wrong lol? Link to comment https://forums.phpfreaks.com/topic/41315-updating-user-information-phpmysql/#findComment-200195 Share on other sites More sharing options...
boo_lolly Posted March 5, 2007 Share Posted March 5, 2007 where's the value for $num being set? Link to comment https://forums.phpfreaks.com/topic/41315-updating-user-information-phpmysql/#findComment-200216 Share on other sites More sharing options...
NickG21 Posted March 5, 2007 Author Share Posted March 5, 2007 $query= "SELECT * FROM ContactInfo WHERE username='$user'"; $result= mysql_query($query); $num = mysql_num_rows($result); $num is supposed to be the value of the username that is selected from the database so it can then take the information linked with it and redisplay on the page to be updated. Link to comment https://forums.phpfreaks.com/topic/41315-updating-user-information-phpmysql/#findComment-200226 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.