PHP: <?php // connecting to database... $user = 'Login'; $qr = mysql_query('SELECT COUNT(*) FROM logins WHERE login="' . mysql_escape_string($user) . '"') or die(mysql_error()); $row = mysql_fetch_row($qr); mysql_free_result($qr); if (1 == $row[0]) print 'User exists'; else print 'User doesn\'t exist'; ?>
Я обычно так делаю: PHP: <?php // connecting to database... $user = 'Login'; $qr = mysql_query('SELECT * FROM logins WHERE login="' . mysql_escape_string($user) . '"') or die(mysql_error()); $row = mysql_fetch_row($qr); mysql_free_result($qr); if ($row['login'] == $user) print 'User exists'; else print 'User doesn\'t exist'; ?>