HCProfessionals Posted March 8, 2011 Share Posted March 8, 2011 $db->query( "UPDATE user_resources, user_buildings, user_units_nonbattle SET user_resources.uGold=user_resources.uGold+(user_buildings.uTownCenterLevel*(user_units_nonbattle.uMiner*10))" ); When the cron runs, it updates everyone the same regardless. Any idea what i'm doing wrong? Link to comment https://forums.phpfreaks.com/topic/230008-update-query-not-working-properly/ Share on other sites More sharing options...
HCProfessionals Posted March 8, 2011 Author Share Posted March 8, 2011 $db->query( "UPDATE user_resources, user_buildings, user_units_nonbattle SET user_resources.uFood=user_resources.uFood+50+(user_buildings.uTownCenterLevel*(user_units_nonbattle.uHunter*10))" ); This one is working properly. This is also the only one that adds +50 every time the cron runs. Link to comment https://forums.phpfreaks.com/topic/230008-update-query-not-working-properly/#findComment-1184632 Share on other sites More sharing options...
HCProfessionals Posted March 8, 2011 Author Share Posted March 8, 2011 Come on guys, I have my website shut down because of this. Link to comment https://forums.phpfreaks.com/topic/230008-update-query-not-working-properly/#findComment-1184658 Share on other sites More sharing options...
litebearer Posted March 8, 2011 Share Posted March 8, 2011 Hmm its workday, and the people here 'donate' their time and talents PRO BONO to help others When updating a db UNLESS you use a WHERE all records will be updated Link to comment https://forums.phpfreaks.com/topic/230008-update-query-not-working-properly/#findComment-1184665 Share on other sites More sharing options...
HCProfessionals Posted March 8, 2011 Author Share Posted March 8, 2011 nah, I got it. had to use LEFT JOIN statements. thanks though Link to comment https://forums.phpfreaks.com/topic/230008-update-query-not-working-properly/#findComment-1184674 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.