Perad Posted November 30, 2006 Share Posted November 30, 2006 I have this[code]INSERT INTO unc_members (userid, unc_group) VALUES ($id, $group)[/code]What i want to do is check to see there is a there is an existing value for the userid. If there is I want to update the value?Can i do this with SQL? Or have a got to use PHP? Link to comment https://forums.phpfreaks.com/topic/28982-check-to-see-if-there-is-a-value-before-updating/ Share on other sites More sharing options...
kid_drew Posted November 30, 2006 Share Posted November 30, 2006 use the "ON DUPLICATE UPDATE" command.INSERT INTO unc_members (userid, unc_group) VALUES ($id, $group) ON DUPLICATE UPDATE set unc_group = '$group' Link to comment https://forums.phpfreaks.com/topic/28982-check-to-see-if-there-is-a-value-before-updating/#findComment-132772 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.