04-12-2012, 03:31 AM
|
#1 (permalink)
|
|
The Visitor
Join Date: Apr 2012
Posts: 1
Thanks: 0
|
Php signup error(please help)
Please really need help with this. i tried writing a script for a sign up page but anytime i try to sign up, it shows this error message mysql_num_rows(): supplied argument is not a valid MySQL result resource what do i do . Here is the code @ the line the error was referred to
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string(sha1($_POST['password']));
$email = mysql_real_escape_string($_POST['email']);
$avatar = mysql_real_escape_string($_POST['avatar']);
$dn = mysql_num_rows(mysql_query('select id from users where username="'.$username.'"'));
if($dn==0)
{
$dn2 = mysql_num_rows(mysql_query('select id from users'));
$id = $dn2+1;
if(mysql_query('insert into users(id, username, password, email, avatar, signup_date) values ('.$id.', "'.$username.'", "'.$password.'", "'.$email.'", "'.$avatar.'", "'.time().'")'))
{
$form = false;
?>
thanks in advance
|
|
|
|