thewhat Posted January 22, 2008 Share Posted January 22, 2008 $userid = ($data['user_id']); if ($userdata['attacking_wars'] == 0) ( $dbquery5 = "UPDATE ".$db_prefix."users SET attack_1= '$userid' WHERE user_id='".$data['user_id']."'" ) ; if ($userdata['attacking_wars'] == 1) ( $dbquery6 = "UPDATE ".$db_prefix."users SET attack_2= '$userid' WHERE user_id='".$data['user_id']."'" ) ; if ($userdata['attacking_wars'] == 2) ( $dbquery7 = "UPDATE ".$db_prefix."users SET attack_3= '$userid' WHERE user_id='".$data['user_id']."'" ) ; I'm doing something wrong because it never updates. I just need it to properly connect. :\ Link to comment https://forums.phpfreaks.com/topic/87231-solved-how-could-i-do-this-lots-of-if-statements/ Share on other sites More sharing options...
revraz Posted January 22, 2008 Share Posted January 22, 2008 Change your lines from if ($userdata['attacking_wars'] == 0) ( $dbquery5 = "UPDATE ".$db_prefix."users SET attack_1= '$userid' WHERE user_id='".$data['user_id']."'" ) ; to if ($userdata['attacking_wars'] == 0) { $dbquery5 = "UPDATE $db_prefix users SET attack_1= '$userid' WHERE user_id='".$data['user_id']."'"; } What is the tablename, like prefixusers? Link to comment https://forums.phpfreaks.com/topic/87231-solved-how-could-i-do-this-lots-of-if-statements/#findComment-446203 Share on other sites More sharing options...
thewhat Posted January 22, 2008 Author Share Posted January 22, 2008 Yeah. All the variables are properly set and all. Thank you, let me try this out and get back to you. Link to comment https://forums.phpfreaks.com/topic/87231-solved-how-could-i-do-this-lots-of-if-statements/#findComment-446209 Share on other sites More sharing options...
kenrbnsn Posted January 22, 2008 Share Posted January 22, 2008 Please post more of your code, especially where you are actually doing the mysql_query() call. Ken Link to comment https://forums.phpfreaks.com/topic/87231-solved-how-could-i-do-this-lots-of-if-statements/#findComment-446211 Share on other sites More sharing options...
thewhat Posted January 22, 2008 Author Share Posted January 22, 2008 Well it worked. That was the entire code anyway, really. Minus a few variable definitions. Topic solved. Link to comment https://forums.phpfreaks.com/topic/87231-solved-how-could-i-do-this-lots-of-if-statements/#findComment-446254 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.