-
Posts
188 -
Joined
-
Last visited
Community Answers
-
BuildMyWeb's post in INSERT if value doesnt already exist was marked as the answer
In case this thread gets searched out, this is the query that worked for me. thanks to help from Jacques1
$stmt_session = $db_connect->prepare( "INSERT INTO sessions ( id, author_id, token, name ) SELECT ?, ?, ?, ? FROM sessions WHERE NOT EXISTS (SELECT author_id FROM sessions WHERE author_id=?) LIMIT 1" )