php mysql user login show user exists -


i'm going through vid tutorial on creating user reg & login form in php , mysql.

the following script should echo 'exists' on login.php form, shows blank (indicating user not exist, when , s in fact username on db)

<?php     function user_exists($username) {    $username = sanitize($username);    $query = mysql_query("select * `users` `username` = '$username'");     return (mysql_result($query, 0) == 1) ? true : false;  } ?> 

the login form portion of code goes follows:

if (user_exists('andy') === true) { echo 'exists'; } die(); 

am missing syntax or obvious?? here link vid tutorial if helps http://www.youtube.com/watch?v=til3ovnlho4

why not this?

<?php function user_exists($username) { $username = sanitize($username); $query = mysql_query("select * `users` `username` = '$username'");  $exists = mysql_num_rows($query) == 1 ? 1 :0;  return $exists;  } ?> 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -