Re: entrycheck
| From: | Hugh Danaher | Date: | Tue, 04 Mar 2003 08:33:26 +0000 |
| Subject: | Re: entrycheck | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-138051@lists.php.net to get a copy of this message | ||
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" <diksha_neel@rediffmail.com>
To: <php-general@lists.php.net>
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
>