I know how to use multiple tables with SELECT queries, but what about UPDATE queries? mysql_query("UPDATE users SET msg=msg+1 WHERE userdata.did='$var' AND id!=$id"); - does not work. Basically I need to update the users table, but only the rows that match 'did' in table userdata with the given $var variable. users and userdata have no other connection... actually users.yid matches userdata.id - but that's how it was in the old query (userdata.id was a variable) - but I now need to pull all rows from userdata where userdata.did='$var' (users.uid and userdata.id are different... Wow, I'm not surprised if you don't understand a thing I tried to say! The actual query is a lot more complex, but I broke it down, so it's easier to understand. I just need to get the general idea. Is it even possible? My second option is a php loop.
You can use joins to do that. UPDATE table1 JOIN table2 ON table1.column1=table2.column2 SET table1.columna='test', table2.columnb='test' WHERE (condition)