vystral Posted May 25, 2007 Share Posted May 25, 2007 For some reason, my UPDATE query isn't working. I don't think I have the syntax wrong. $restidquery="select restaurantid from restaurants where restaurantname='$restaurantname'"; $restidresult=mysql_query($restidquery); $restidrow=@mysql_fetch_assoc($restidresult); $restid=$restidrow['restaurantid']; mysql_query("UPDATE users SET restaurantid='$restid' WHERE username='$username'") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/52973-mysql-update/ Share on other sites More sharing options...
chigley Posted May 25, 2007 Share Posted May 25, 2007 Use this for debugging: <?php $restidquery="select restaurantid from restaurants where restaurantname='$restaurantname'"; $restidresult=mysql_query($restidquery) or die(mysql_error()); $restidrow=mysql_fetch_assoc($restidresult); $restid=$restidrow['restaurantid']; $q = mysql_query("UPDATE users SET restaurantid='$restid' WHERE username='$username'") or die(mysql_error()); ?> Where are $restaurantname and $username defined? Link to comment https://forums.phpfreaks.com/topic/52973-mysql-update/#findComment-261664 Share on other sites More sharing options...
vystral Posted May 25, 2007 Author Share Posted May 25, 2007 from a form on a previous page. I used $_POST for both of them Link to comment https://forums.phpfreaks.com/topic/52973-mysql-update/#findComment-261665 Share on other sites More sharing options...
vystral Posted May 25, 2007 Author Share Posted May 25, 2007 Wow, I don't believe this. It just started working out of nowhere. Took time for server update maybe?? Link to comment https://forums.phpfreaks.com/topic/52973-mysql-update/#findComment-261705 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.