+ Reply to Thread
Results 1 to 2 of 2

Thread: Create account script help

  1. #1
    salukigirl is offline x10Hosting Member salukigirl is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    78

    Create account script help

    Hi. Um, I'm using this script and I have my database table named users. But something isn't working... I don't really know how to explain it better...

    PHP Code:
    <?php

    include_once("sql_connect.php");

    $username $_POST['username'];
    $email $_POST['email'];
    $password $_POST['password'];
    $confirm $_POST['confirm'];
    $website $_POST['website'];

    $users_query mysql_query("SELECT * FROM user");
    $num_user mysql_num_rows$user_query );

    if ( 
    $password == $confirm )
    {
    if ( 
    $num_user )
    {
    $user_query mysql_query("SELECT * FROM user WHERE email='".$email."'");
    $num_user_email mysql_num_rows$user_query );

    if ( 
    $num_user_email == )
    {
    $user_query mysql_query("SELECT * FROM user WHERE username='".$username."'");
    $num_user_username mysql_num_rows$user_query );

    if ( 
    $num_user_username == )
    {
    $user_query mysql_query("INSERT INTO user VALUES( NULL, '".$username."', '".$email."', '".$password."', '".$website."')");

    echo 
    'User account has been created!';
    }
    else
    {
    echo 
    'Username is already taken!';
    }
    }
    else
    {
    echo 
    'Email address is already in use by another user';
    }
    }
    else
    {
    $user_query mysql_query("INSERT INTO user VALUES( NULL, '".$username."', '".$email."', '".$password."', '".$website."')");

    echo 
    'User account has been created!';
    }
    }
    else
    {
    echo 
    'Passwords do not match';
    }

    ?>
    But I keep getting this error...

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/star/public_html/create_account.php on line 12
    User account has been created!


    Does anyone see what might be wrong in the coding?

  2. #2
    halohalo's Avatar
    halohalo is offline x10Hosting Member halohalo is an unknown quantity at this point
    Join Date
    Aug 2007
    Posts
    54

    Re: Create account script help

    Quote Originally Posted by salukigirl View Post
    Hi. Um, I'm using this script and I have my database table named users. But something isn't working... I don't really know how to explain it better...

    PHP Code:
    <?php
     
    include_once("sql_connect.php");
     
    $username $_POST['username'];
    $email $_POST['email'];
    $password $_POST['password'];
    $confirm $_POST['confirm'];
    $website $_POST['website'];
     
    $users_query mysql_query("SELECT * FROM user");
    $num_user mysql_num_rows$user_query );
    But I keep getting this error...

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/star/public_html/create_account.php on line 12
    User account has been created!


    Does anyone see what might be wrong in the coding?


    Just a hunch... I noticed on line 11 that your reference:
    PHP Code:
    $users_query mysql_query("SELECT * FROM user"); 
    is the same reference called in the following line (12):
    PHP Code:
    $num_user mysql_num_rows$user_query ); 
    Notice that
    PHP Code:
    $users_query = ... 
    is not the same as
    PHP Code:
    mysql_num_rows$user_query );... 
    You're missing an "s" in $user_query...

    try that first...
    Halo-Halo
    Resident Pogy-Pinoy and
    Technology Enthusiast

    My Technology Forums
    A Site for Anime Fans

    A link to one of the most awesome free, online, sci-fi strategy games created to date. Click on my userbar below to join me in the Ceti galaxy for a couple of rounds in deep space...


    Go Tritons!

+ Reply to Thread

Similar Threads

  1. Replies: 5
    Last Post: 09-02-2007, 11:19 AM
  2. Replies: 2
    Last Post: 09-01-2007, 09:30 PM
  3. Can't create account!
    By ulclanx1 in forum Free Hosting
    Replies: 8
    Last Post: 10-31-2005, 11:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers