Jump to content

michaelkane

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

michaelkane's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi guys how are you doing, I am unable to execute very basic php script connecting with mysql. being a noob I just need a quick fix thats all.. here is the code: <?php session_start(); ?> <html> <body> <form action='index.php?login=yes' method=POST> Username: <input type=text name='user'><br/> Password: <input type=password name='pass'><br/> <input type=submit value='SignIn!'> </form> <?php $user=$_POST['user']; $pass=$_POST['pass']; $login=$_GET['login']; if($login=='yes'){ $con=mysql_connect('localhost','root',''); mysql_select_db('test'); $get=mysql_query("SELECT count(id) FROM database WHERE user='$user' and pass='$pass'"); $result=mysql_result($get,0); mysql_close($con); if($result!=1) echo "Login failure"; else{ echo "Login success !"; $_SESSION['user']=$user; }; }; ?> <body> </html> error I am getting is: Warning: mysql_result() expects parameter 1 to be resource, boolean given in C:\roooooot\xampp\htdocs\index.php on line 22 Login failure 1. I am assuming root and '' pass is to login mysql. 2. test is the database 3. 'database' is the table where it is checking user/pass the rest is straightforward. can anyone explain what could be wrong. getting same error with a nonexisting database. Thank you!
×
×
  • 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.