Jump to content


help needed with me log on script

  • Please log in to reply
1 reply to this topic

#1 pravin_fer

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 15 August 2006 - 09:52 AM

hello folks i am new to php
i have created a log on script to check userid and password from mysql database, but even if i enter correct uesrname and password it doesnt display correct message
plse help me

    include 'database_connect.private'; 



header("Cache-control: private");

$connection = mysql_connect($hostname,$username,$password);
      mysql_select_db($databaseName, $connection);
/* $result = mysql_query ("SELECT * FROM staff", $connection);

while ($row = mysql_fetch_row($result))
echo "hello";
if($pid==$row[0] && $passwrd==$row[1])
{echo "hello";


$query="SELECT * FROM staff WHERE staff_Id ='$pid' AND password='$passwrd' ";
//or die(mysql_error());
echo "try";

if (mysql_num_rows($result)==1)
echo "user logged in";
echo "Successful login ... Click Here to ";
//redirect ("http://stuweb.cms.gr...j330/home.html")
echo "<p> Sorry Unauthorized Access is not Allowed</p>";




#2 ToonMariner

  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 15 August 2006 - 09:57 AM

test your query in phpmyadmin or similar and see what is returned...
(echo out your query string before you run the query - then you can copy and paste into your favorite db app!)
follow me on twitter @PHPsycho

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users