entrycheck
| From: | Diksha Neel | Date: | Tue, 04 Mar 2003 06:50:49 +0000 |
| Subject: | entrycheck | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-138041@lists.php.net to get a copy of this message | ||
HI EVERYBODY,
WHEN I RUN MY PHP SCRIPT TYPED BELOW, I GET 'connected successfully
query failed'.
i have in bdoi_change database a table called entry with 2 fields:
login and pass in which i have put some data.
can anyone help out?
regards,
diksha.
I HAVE AN HTML FORM BY NAME entry.html the code of
which is the following:
<form method="POST" action="check.php">
User Name<input type="text" name="login">
User Password <input type="password" name="pass">
<input type="submit" value="validate me">
</form>
AND THE check.php code is as follows:
<?php
$connection=mysql_connect("localhost","root","")or die("Could not connect");
print "Connected successfully<br>";
mysql_select_db("bdoi_change")or die("could not select database");
$query = "select * from entry where login='$login' and pass='$pass' ";
$result = mysql_query($query,$connection) or die("Query failed");
$num=mysql_num_rows($result);
//present results based on validity.
echo "$num<br>";
if($num==1)
{
echo "<P>You are a valid user!<br>";
}
if($num==0)
{
echo "you are not authorised";
}
?>