Suggestions:

1) Can you try this at the database console and see what is returned.

2) Have you echoed $sql to see if the statement looks right. I only ask 
this because I've been certain that I have a correct statement and then 
found out that nothing is coming back.

3) What happens if $aff_sport is null or empty?

4) Without looking at the MySQL docs., is there a password() function in MySQL?

Cheers - Miles

At 02:30 PM 5/3/01 +0100, Russ Michell wrote:
>Hi all:
>
>I have a seemingly simple SQL problem when using the following 
>PHP4/MySQL-3.22.32 query:
>
>$sql="SELECT * FROM $table_users WHERE usrName='$username' AND 
>usrPswd=password('$password') AND affiliation='$aff_sport'";
>$result = mysql_query($sql, $connection) or header("Location: 
>error.php?err=query");
>         $num = mysql_num_rows($result);
>         //User hasn't been found in DB with current details:
>         if ($num != 1) {
>                 header("Location: error.php?err=n_player");
>                 exit;
>                 }
>         //Else get vars and authenticate
>         else {
>         //while loop get's vars etc etc
>         }
>
>My error checking mechanism check's if the inputted details can be found 
>in the DB if not you are taken to an error page.
>The table $table_users, at present has 2 rows where the same 
>username/password crops up, but different data
>(other than the username and password) in their respective rows.
>
>At it stands, I am taken to the error page. If I remove one of the 
>same-name users it works fine.
>What can I do to this query or even my table to remedy this so I can have 
>multiple same-name users/pswds but with different data,
>such as 'affiliation' as above for example??
>
>Please help - as I have nearly completed the project....just some fiddly 
>lil' things need to be sorted..
>Many thanks.
>
>Russ
>
>#-------------------------------------------------------#
>
>          "Believe nothing - consider everything"
>            "Web Developers do it on-the-fly."
>
>   Russ Michell
>   Anglia Polytechnic University Webteam
>
>   e: [EMAIL PROTECTED]
>   w: www.apu.ac.uk/webteam
>   t: +44 (0)1223 363271 x 2331
>
>   www.theruss.com
>
>#-------------------------------------------------------#
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to