cs1h Posted January 21, 2009 Share Posted January 21, 2009 Hey, I have this small query but I can't get it working. The code is, <?php $Abs=$_POST['goingTo']; if(empty($Abs)){ echo ""; }else{ include("config.php"); mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); mysql_select_db("bbvb") or die(mysql_error()) ; $sql = ("UPDATE vvvv SET goingTo='$Abs' WHERE Code_1 = '$code1' AND username='$username_b'"); if (mysql_query($sql)) { echo ""; } else { echo "There has been a problem updating your next destination"; } } ?> Does any one know whats going wrong? Thanks, Cs1h Quote Link to comment https://forums.phpfreaks.com/topic/141835-solved-database-not-updating/ Share on other sites More sharing options...
Maq Posted January 21, 2009 Share Posted January 21, 2009 Please change this line to: if (mysql_query($sql)or die(mysql_error())) { and tell me what the output is. Quote Link to comment https://forums.phpfreaks.com/topic/141835-solved-database-not-updating/#findComment-742617 Share on other sites More sharing options...
cs1h Posted January 21, 2009 Author Share Posted January 21, 2009 Hi, Its not coming up with any errors. Cheers, Cs1h Quote Link to comment https://forums.phpfreaks.com/topic/141835-solved-database-not-updating/#findComment-742626 Share on other sites More sharing options...
Maq Posted January 21, 2009 Share Posted January 21, 2009 Change this line to: $sql = "UPDATE vvvv SET goingTo='$Abs' WHERE Code_1 = '$code1' AND username='$username_b'"; and add: echo $sql; to make sure you're passing the correct values. Quote Link to comment https://forums.phpfreaks.com/topic/141835-solved-database-not-updating/#findComment-742631 Share on other sites More sharing options...
cs1h Posted January 21, 2009 Author Share Posted January 21, 2009 Hi, Thanks that has identified the error. It came up with UPDATE vvvvv SET proUpdate='12 nn' WHERE Code_1 = '' AND username=''; It's not getting the WHERE criteria. A lot of thanks for the help, Cs1h Quote Link to comment https://forums.phpfreaks.com/topic/141835-solved-database-not-updating/#findComment-742649 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.