PHP Programming Tutorial – Creating A Simple MySQL Login Form




Follow me on Twitter @ http://twitter.com/tktutorials Check out my website @ http://www.timkipptutorials.com In this tutorial we will be building a very simple login …

Original source


24 responses to “PHP Programming Tutorial – Creating A Simple MySQL Login Form”

  1. please help me to correct this error
    Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in E:xampphtdocsproject 1login.php on line 16
    inValid information…

  2. Do you know how I can fix this error.. "The requested URL /Assignment 1/login.php was not found on this server." When I typed in the username and password on the login form. Thanks in advance

  3. i get this error does somebody know what i do wrong?
    Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:xampphtdocslogin.php:11 Stack trace: #0 {main} thrown in C:xampphtdocslogin.php on line 11

  4. hi Tim,

    iam getting the following error, the query is getting executed in phpmyadmin..

    Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in D:xampphtdocsbbox_orderlogin.php on line 12

    here is my code

    <?php
    require_once 'config.php';

    if(isset($_POST['submit']))
    {
    $username = $_POST['username'];
    $password= $_POST['password'];
    $sql = "SELECT user,password FROM user WHERE user='".$username."'AND password='".$password."' LIMIT 1";

    $res = mysql_query($sql);
    ;
    echo "$count";
    if(mysql_num_rows($res) == 1)
    {
    echo "login successful";
    //index.php;
    exit();
    }else
    {
    echo "please enter correct login";
    exit();
    }
    }
    ?>
    <html>
    <title>Login</title>
    <body>
    <form method="POST" action="login.php">
    Username :<input type="text" name="username"><br/><br/>
    Password :<input type="text" name="password"><br/><br/>
    <input type="submit" name="submit" value="login">

    </form>
    </body>
    </html>

Leave a Reply