Dethman Posted July 9, 2008 Share Posted July 9, 2008 if($_POST['defcon']){ $defcon=$_POST['defcon_rate']; $q=mysql_query("INSERT INTO `user_users` SET `alert`='$defcon' WHERE `userid`='$player['userid']'"); if( $q ){ header("location: lair.php?strErr=You Have Upgraded Your Defcon Rate"); } } I think there may be something wrong with this can someone help? Thanks, Brian Flores AKA Dethman Link to comment https://forums.phpfreaks.com/topic/114002-can-someone-see-if-this-has-any-errors/ Share on other sites More sharing options...
ShimmyShine Posted July 9, 2008 Share Posted July 9, 2008 Try this: if(isset($_POST['defcon'])){ $defcon = $_POST['defcon_rate']; $player = $player['userid']; $q = "UPDATE `user_users` SET `alert`='$defcon' WHERE `userid`='$player'"; $result = mysql_query($q); if($result){ header("location: lair.php?strErr=You Have Upgraded Your Defcon Rate"); } else { echo "Error"; } } Shimmy Link to comment https://forums.phpfreaks.com/topic/114002-can-someone-see-if-this-has-any-errors/#findComment-585914 Share on other sites More sharing options...
DarkWater Posted July 9, 2008 Share Posted July 9, 2008 Yeah, you can't use SET in an INSERT statement: $q = "INSERT INTO `user_users` SET `alert`='$defcon' WHERE `userid`='$player'"; Maybe you meant UPDATE? Link to comment https://forums.phpfreaks.com/topic/114002-can-someone-see-if-this-has-any-errors/#findComment-585916 Share on other sites More sharing options...
trq Posted July 9, 2008 Share Posted July 9, 2008 SET is perfectly valid in an INSERT statement. The big question here is, does it work? Your meant to tell us something isn't working, describing what you want it to do and what it actually does do, from there we attempt to help. Simply stating you 'think' something may be wrong gets us knowhere. Link to comment https://forums.phpfreaks.com/topic/114002-can-someone-see-if-this-has-any-errors/#findComment-585918 Share on other sites More sharing options...
ShimmyShine Posted July 9, 2008 Share Posted July 9, 2008 Forgot to change that part Shimmy Link to comment https://forums.phpfreaks.com/topic/114002-can-someone-see-if-this-has-any-errors/#findComment-585920 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.