Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2005
    Location
    Dog House
    Posts
    1,000
    Tokens
    0

    Latest Awards:

    Default Php Error On This - Help Please.

    Errors ;
    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home2/extreme/public_html/login/register.php on line 27

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home2/extreme/public_html/login/register.php on line 30
    Table 'extreme_join.users' doesn't exist


    Any ideas?

    Im creating a simpel login / register system and when you enter all info to register you click enter and that error comes.

    Thanks,
    Whitecorn.

  2. #2
    Join Date
    Jul 2004
    Location
    Webby Forums!
    Posts
    1,879
    Tokens
    0

    Latest Awards:

    Default

    post the contents of register please Also are you using the phpfreaks tutorial??


    Chilimagik.net // Reviews, Band Biographies, News, Pics + Loads More!!
    [Thybag.co.uk - Vive la revolutione]

  3. #3
    Join Date
    Mar 2005
    Location
    Dog House
    Posts
    1,000
    Tokens
    0

    Latest Awards:

    Default

    No im not :p

    PHP Code:
    <?php
    // set your infomation.
    $dbhost='localhost';
    $dbusername='extreme_join';
    $dbuserpass='5d9v8e';
    $dbname='extreme_join';
    // connect to the mysql database server.
    mysql_connect ($dbhost$dbusername$dbuserpass);
    mysql_select_db($dbname) or die("Cannot select database");

    //Are they just getting here or submitting their info?
    if (isset($_POST["username"])) {
    $username $_POST["username"];
    $password $_POST["password"];
    $cpassword $_POST["cpassword"];
    $email $_POST["email"];
    //Was a field left blank?
    if($username==NULL|$password==NULL|$cpassword==NULL|$email==NULL) {
    echo 
    "A field was left blank.";
    }else{
    //Do the passwords match?
    if($password!=$cpassword) {
    echo 
    "Passwords do not match";
    }else{
    //Has the username or email been used?
    $checkuser mysql_query("SELECT username FROM users WHERE username='$username'");
    $username_exist mysql_num_rows($checkuser);

    $checkemail mysql_query("SELECT email FROM users WHERE email='$email'");
    $email_exist mysql_num_rows($checkemail);

    if (
    $email_exist>0|$username_exist>0) {
    echo 
    "The username or email is already in use";
    }else{
    //Everything seems good, lets insert.
    $query "INSERT INTO users (username, password, email) VALUES('$username','$password','$email')";
    mysql_query($query) or die(mysql_error());
    echo 
    "The user $username has been successfully registered.";
    }
    }
    }
    }
    ?>
    <h1>Register</h1>
    <form action="register.php" method="POST">
    <table style="border:1px solid #000000;">
    <tr>
    <td align="right">
    Username: <input type="text" size="15" maxlength="25" name="username">
    </td>
    </tr>
    <tr>
    <td align="right">
    Password: <input type="password" size="15" maxlength="25" name="password">
    </td>
    </tr>
    <tr>
    <td align="right">
    Confirm Password: <input type="password" size="15" maxlength="25" name="cpassword">
    </td>
    </tr>
    <tr>
    <td align="right">
    Email: <input type="text" size="15" maxlength="25" name="email">
    </td>
    </tr>
    <tr>
    <td align="center">
    <input type="submit" value="Register">
    </td>
    </tr>
    <tr>
    <td align="center">
    <a href="login.php">Login Here</a>
    </td>
    </tr>
    </table>
    </form>
    </center>
    There You Go :p

  4. #4
    Join Date
    Mar 2005
    Location
    Dog House
    Posts
    1,000
    Tokens
    0

    Latest Awards:

    Default

    Enigma bumping means i have to ROFL!
    Bump ^_^

  5. #5
    Join Date
    Aug 2004
    Location
    Over there. ^_^
    Posts
    1,100
    Tokens
    0

    Latest Awards:

    Default

    this looks exactly like the thing im using at the moment so ill look through mine and check

    try running this file

    PHP Code:
    <?php
    // set your infomation.
    $dbhost='localhost';
    $dbusername='extreme_join';
    $dbuserpass='5d9v8e';
    $dbname='extreme_join';
    // connect to the mysql database server.
    mysql_connect ($dbhost$dbusername$dbuserpass);
    //select the database
    mysql_select_db($dbname) or die('Cannot select database');

    //create the table, customize it if you want
    $query 'CREATE TABLE users(
    id INT NOT NULL AUTO_INCREMENT,
    PRIMARY KEY(id),
    username VARCHAR(30) NOT NULL,
    password VARCHAR(20) NOT NULL,
    email VARCHAR(40) NOT NULL)'
    ;
    $result mysql_query($query);
    echo 
    "Table Created!";
    ?>
    *Image Removed


    Ahemm.. How exactly was my sig innapropriate?
    Goddamit i hate this forum :@
    I RESIGN FROM GRAPHICS DESIGNER :@ :@ :@

  6. #6
    Join Date
    Jul 2004
    Location
    Webby Forums!
    Posts
    1,879
    Tokens
    0

    Latest Awards:

    Default

    that seems fine :S The coding seems ok.. sure you are connected to the database... although thats a different error "/ Im stuck sorry.


    Chilimagik.net // Reviews, Band Biographies, News, Pics + Loads More!!
    [Thybag.co.uk - Vive la revolutione]

  7. #7
    Join Date
    Aug 2004
    Location
    Over there. ^_^
    Posts
    1,100
    Tokens
    0

    Latest Awards:

    Default

    try running this file! call it install.php

    PHP Code:
    <?php
    // set your infomation.
    $dbhost='localhost';
    $dbusername='extreme_join';
    $dbuserpass='5d9v8e';
    $dbname='extreme_join';
    // connect to the mysql database server.
    mysql_connect ($dbhost$dbusername$dbuserpass);
    //select the database
    mysql_select_db($dbname) or die('Cannot select database');

    //create the table, customize it if you want
    $query 'CREATE TABLE users(
    id INT NOT NULL AUTO_INCREMENT,
    PRIMARY KEY(id),
    username VARCHAR(30) NOT NULL,
    password VARCHAR(20) NOT NULL,
    email VARCHAR(40) NOT NULL)'
    ;
    $result mysql_query($query);
    echo 
    "Table Created!";
    ?>
    *Image Removed


    Ahemm.. How exactly was my sig innapropriate?
    Goddamit i hate this forum :@
    I RESIGN FROM GRAPHICS DESIGNER :@ :@ :@

  8. #8
    Join Date
    Mar 2005
    Location
    Dog House
    Posts
    1,000
    Tokens
    0

    Latest Awards:

    Default

    OMG! it works ROFL thanks alot, And maybe it is maybe we have great minds ;p.

    Anyway thanks
    Whitecorn.
    Last edited by :Woof; 04-08-2005 at 04:43 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
  •