I'm trying to update a users details inside an SQL database, however if a row of that user dose not exist, I need to create one for that user (Only one per user) It's just not updating nor inserting. Here is the following script.
$sql = "IF EXISTS (SELECT * FROM user_details WHERE user_id = $user_id)
UPDATE user_details SET work = $work, education = $education, location = $location, relationship = $relationship, phone = $phone, email = $email, website = $website, language = $language, skill = $skill, tumbkr = $tumblr, instagram = $instagram, skype = $skype, facebook = $facebook, youtube = $youtube, twitter = $twitter, about = $about, user_id = $user_id WHERE user_id = $user_id
ELSE
INSERT INTO user_details (work, education, location, relationship, phone, email, website, language, skill, tumblr, instagram, skype, facebook, youtube, twitter, about, user_id)";
$q = $conn->prepare($sql);
$q->execute();