ragrim Posted December 12, 2008 Share Posted December 12, 2008 Hi, im trying to display mysql results in a form but for some reason im only getting the first field and not the rest, it will show me the "firstname" field but nothing else, for the life of me cant figure out why, any help would be appreciated. <?php $sql = mysql_query("SELECT * FROM invoicing.customers WHERE id = '$id' "); $sql_res = mysql_query($sql); //execute query while($row = mysql_fetch_array($sql)) $firstname=$row['firstname']; $lastname=$row['lastname']; $address=$row['address']; $suburb=$row['suburb']; $postcode=$row['postcode']; $phone1=$row['phone1']; $phone2=$row['phone2']; $email1=$row['email1']; $email2=$row['email2']; $billingemail=$row['billingemail']; ?> and then i display it in forms with <td>First Name<input name="firstname" style="width: 191px" type="text" class="style15" value="<?php print "$firstname" ?>"></td> <td>Last Name<input name="lastname" type="text" class="style14" value="<?php print "$lastname" ?>" style="width: 191px"> </td> has it got something to do with the fact im using $row? Quote Link to comment https://forums.phpfreaks.com/topic/136624-not-displaying-all-results/ Share on other sites More sharing options...
Maq Posted December 12, 2008 Share Posted December 12, 2008 Surprised you got any results at all... Try: $sql = mysql_query("SELECT * FROM customers WHERE id = '$id' "); $sql_res = mysql_query($sql); //execute query while($row = mysql_fetch_array($ql_res)) { $firstname=$row['firstname']; $lastname=$row['lastname']; $address=$row['address']; $suburb=$row['suburb']; $postcode=$row['postcode']; $phone1=$row['phone1']; $phone2=$row['phone2']; $email1=$row['email1']; $email2=$row['email2']; $billingemail=$row['billingemail']; } Quote Link to comment https://forums.phpfreaks.com/topic/136624-not-displaying-all-results/#findComment-713364 Share on other sites More sharing options...
zero118 Posted December 12, 2008 Share Posted December 12, 2008 He meant: $sql = mysql_query("SELECT * FROM customers WHERE id = '$id' "); $sql_res = mysql_query($sql); //execute query while($row = mysql_fetch_array($sql_res)) //Forget the "S" { $firstname=$row['firstname']; $lastname=$row['lastname']; $address=$row['address']; $suburb=$row['suburb']; $postcode=$row['postcode']; $phone1=$row['phone1']; $phone2=$row['phone2']; $email1=$row['email1']; $email2=$row['email2']; $billingemail=$row['billingemail']; } Quote Link to comment https://forums.phpfreaks.com/topic/136624-not-displaying-all-results/#findComment-713368 Share on other sites More sharing options...
ragrim Posted December 12, 2008 Author Share Posted December 12, 2008 haha so easy, i knew it had to be something simple. thanks heaps for the qucik reply Quote Link to comment https://forums.phpfreaks.com/topic/136624-not-displaying-all-results/#findComment-713369 Share on other sites More sharing options...
Maq Posted December 12, 2008 Share Posted December 12, 2008 thx zero @ragrim, could you mark as solved please, thanks! Quote Link to comment https://forums.phpfreaks.com/topic/136624-not-displaying-all-results/#findComment-713373 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.