jaymc Posted July 9, 2008 Share Posted July 9, 2008 I have this $q = "UPDATE members m INNER JOIN members_info mi ON m.username = mi.username SET fullname = '$fullname', $location nightclub = '$nightclub', email = '$email', footyteam = '$football', relationship = '$relationship', profession = '$profession', favmusic = '$music', sexuality = '$sexuality', last_updated = '$time', mi.info = '$message' WHERE m.username = '$user'"; Works fine, however, I want to join another table to that UPDATE so I can update another field. The only problem is, the row may not exist so if the update fails for that row, it needs to insert it. I guess its the same princeaple as REPLACE INTO exist its withing a query JOINED IN Any ideas? Quote Link to comment Share on other sites More sharing options...
fenway Posted July 10, 2008 Share Posted July 10, 2008 You should be able to use INSERT... ON DUPLICATE KEY update, since you can pass it a select statement for the values... never tried this, through. Quote Link to comment 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.