MasterACE14 Posted July 12, 2008 Share Posted July 12, 2008 hi, I'm having trouble with a MySQL query. I keep receiving this error: Column 'offense' in field list is ambiguous I have no idea what I have to do to fix this problem. here's my code: <?php $sql = "UPDATE `Army` INNER JOIN `UserInfo` ON `UserInfo`.`id` = `Army`.`id` SET `offense` = `offense` + '$amount', `awakened` = `awakened` - '$amount', `UserInfo`.`magi_ava` = (`UserInfo`.`magi_ava` * 1) - '$price' WHERE `UserInfo`.`id` = '$id'"; mysql_query($sql) or die("Cannnot Buy Attack Soldier<br>" . mysql_error()); Any help is greatly appreciated. Regards ACE Link to comment https://forums.phpfreaks.com/topic/114394-solved-column-offense-in-field-list-is-ambiguous/ Share on other sites More sharing options...
bothwell Posted July 12, 2008 Share Posted July 12, 2008 I think SQL wants you to specify which table offense belongs to in the join. Try: $sql = "UPDATE `Army` INNER JOIN `UserInfo` ON `UserInfo`.`id` = `Army`.`id` SET `offense` = `Army`.`offense` + ? Link to comment https://forums.phpfreaks.com/topic/114394-solved-column-offense-in-field-list-is-ambiguous/#findComment-588256 Share on other sites More sharing options...
MasterACE14 Posted July 12, 2008 Author Share Posted July 12, 2008 still no good :-\ Link to comment https://forums.phpfreaks.com/topic/114394-solved-column-offense-in-field-list-is-ambiguous/#findComment-588294 Share on other sites More sharing options...
vikramjeet.singla Posted July 12, 2008 Share Posted July 12, 2008 try this... $sql = "UPDATE `Army` INNER JOIN `UserInfo` ON `UserInfo`.`id` = `Army`.`id` SET `Army`.`offense` = `Army`.`offense` + '$amount', `awakened` = `awakened` - '$amount', `UserInfo`.`magi_ava` = (`UserInfo`.`magi_ava` * 1) - '$price' WHERE `UserInfo`.`id` = '$id'"; Link to comment https://forums.phpfreaks.com/topic/114394-solved-column-offense-in-field-list-is-ambiguous/#findComment-588295 Share on other sites More sharing options...
MasterACE14 Posted July 13, 2008 Author Share Posted July 13, 2008 That fixed it. Thankyou! Link to comment https://forums.phpfreaks.com/topic/114394-solved-column-offense-in-field-list-is-ambiguous/#findComment-588655 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.