Organizational Research By

Surprising Reserch Topic

simple php sql login troubleshooting

simple php sql login troubleshooting  using -'php,mysql,sql'

I am trying to create a very basic PHP login by retrieving a registered username/password from a database. This is not ever going live and I am aware there is zero input validation. All I'm trying to do is select data from a database in a login.

Here is the login form on index.html:

    <table width="250" border="0" align="center" cellpadding="0" cellspacing="1"    bgcolor="#CCCCCC">
    <form name="form1" method="post" action="checklogin.php">
    <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
    <td colspan="3"><strong>Member Login </strong></td>
    <td width="78">Username</td>
    <td width="6">:</td>
    <td width="294"><input name="Username" type="text" id="Username"></td>
    <td><input name="Password" type="text" id="Password"></td>
    <td><input type="submit" name="Submit" value="Login"></td>

And here is the PHP checklogin.php:


    $sql_connection = mysqli_connect ("localhost:8889","root","root","derek_website_tmp");

    if (mysqli_connect_errno())
 echo "failed to connect" . mysqli_connect_error();


    $sql = "SELECT * FROM $Members WHERE Username = '$Username' and Password = '$Password'"

    $count = mysql_num_rows($result);

    if ($count==1) {
    $_SESSION['Username'] = $Username;
    $_SESSION['Password'] = $Password;

    else {
    echo 'Wrong Username or Password';

    if (!mysqli_query($sql_connection))
die('Error : ' . mysqli_error($sql_connection));

    mysqli_close ($sql_connection);


When I try this I get an error retrieving checklogin.php
Any help would be greatly appreciated.

asked Oct 13, 2015 by patelnikul321
0 votes

Related Hot Questions

Government Jobs Opening