perky416 Posted May 5, 2011 Share Posted May 5, 2011 Hi everyone, Sorry i have posted a very similar question before however i believe it was a little difficult to understand so hopefully this is easier to get. Please could anybody tell me if it is possible to update table_1 if a field in table_2='whatever value'? EXAMPLE: mysql_query (UPDATE table_1 SET field_1='whatever' WHERE id='$id' IF field_from_table_2='whatever'); If the above is possible please could somebody point me in the right direction of how to word it correctly? Iv done extensive searches on google however i cant find anything that helps me. Many thanks. Quote Link to comment https://forums.phpfreaks.com/topic/235625-mysql_query-update-1-tables-based-on-another/ Share on other sites More sharing options...
mikosiko Posted May 5, 2011 Share Posted May 5, 2011 yes. did you read the UPDATE manual pages? http://dev.mysql.com/doc/refman/5.0/en/update.html the last few paragraphs before the "Users Comments" show you how.... hint: JOIN Quote Link to comment https://forums.phpfreaks.com/topic/235625-mysql_query-update-1-tables-based-on-another/#findComment-1211046 Share on other sites More sharing options...
perky416 Posted May 5, 2011 Author Share Posted May 5, 2011 Perfect! Thank You!!!!!! Quote Link to comment https://forums.phpfreaks.com/topic/235625-mysql_query-update-1-tables-based-on-another/#findComment-1211052 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.