I\'m using MySQL with PHP and I need to do something like this (pseudocode):
if (sql row exists where username=\'bob\') { // do this stuff }
another approach
$user = "bob"; $user = mysql_real_escape_string($user); $result = mysql_query("SELECT COUNT(*) AS num_rows FROM my_table WHERE username='{$user}' LIMIT 1;"); $row = mysql_fetch_array($result); if($row["num_rows"] > 0){ //user exists }