Check to see if MySQL record exists

If you have ever had script that you need to check before updating/deleteing a MySQL record here is a quick code to check:

if(mysql_num_rows(mysql_query("SELECT userid FROM plus_signup WHERE id = '$userid'")))
{
    // Code inside if block if userid is already there
}

Comments are closed.