Jump to content

error parameter


dean012

Recommended Posts

error on line 66

 

 

 

<html>
    <head>
        <title>Registration Form</title>
    </head>

<body>
<form method='post' action='registration.php'>
    <table width='400' border='5' align='center'>
    
        <tr>
        <td><h1>Registration Form</h1></td>
        
    </tr>
    
    <tr>
        <td>User Name:</td>
        <td><input type='text' name='name'/></td>
    </tr>
    
    <tr>
        <td>Password:</td>
        <td><input type='password' name='pass'/></td>
    </tr>
    <tr>
        <td>Email:</td>
        <td><input type='text' name='email'/></td>
    </tr>
    <tr>
        <td><input type='submit' name='submit' value='Sign Up'/></td>
        
    </tr>
    
    </table>
</form>    
</body>
</html>
<?php
mysql_connect("localhost","root","");
mysql_select_db("user_db");
    if(isset($_POST['submit'])){
    
    $user_name = $_POST['name'];
    $user_pass = $_POST['pass'];
    $user_email = $_POST['email'];
    
    if($user_name==''){
    echo "<script>alert('Please enter your Username')</script>";
    exit();
    }
    
    if($user_pass==''){
    echo "<script>alert('Please enter your password')</script>";
    exit();
    }
    
    if($user_email==''){
    echo "<script>alert('Please enter your email')</script>";
    exit();
    }
    
    $check_email="select *select* from users where
    user_email='$user_email'";
    
    $run = mysql_query($check_email);
    
    if(mysql_num_rows($run)>0){
    
    echo"<script>alert('Email $user_email
    is already exist in our databse, please try another
    one')</script>";
    exit();
    }
    
    $query = "insert into users
    (user_name,user_pass,user_email) values('
    $user_name','$user_pass','$user_email')";
    if(mysql_query($query)){
    
    echo "<script>alert('Registration
    Successfull!')</script>";
    }
    
}
    


?>

Link to comment
Share on other sites

i mean, correct - you do have an error there. If you would like someone to comment on how to fix it then please make sure you put a bit more information in your post as to what the problem is and what you have done to solve the issue so far. To start you off, ensure 

 $user_email

is not returning something that is causing the string to escape

Link to comment
Share on other sites

If the parameter is NOT a resource, and you are passing it the result of a query, then the query must be returning false, which is boolean.  A query returning false means it failed.  The first recourse of action for this would be to return the query error using mysql_error. This would tell you that you have a malformed query string, which would lead you to looking up the proper http://dev.mysql.com/doc/refman/5.0/en/select.html'>SELECT syntax for a MySQL query string.

 

You should be using mysqli_error because you should be using mysqli or PDO at this point.

Link to comment
Share on other sites

Warning: mysqli_query() expects at least 2 parameters, 1 given in G:\xampp\htdocs\Registration\registration.php on line 64

Warning: mysql_num_rows() expects parameter 1 to be resource, null given in G:\xampp\htdocs\Registration\registration.php on line 66

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.