Add the mysql_error() function to your script and run it again. Could give you some hint at what is wrong.
$result = mysql_query($query,$connection) or die("Query failed".mysql_error()); ----- Original Message ----- From: "Diksha Neel" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, March 03, 2003 10:50 PM Subject: [PHP] entrycheck > 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"; > } > ?> > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php