Simple query problem

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: Simple query problem
Groups: php.db 
Request: Send a blank email to php-db+get-9090@lists.php.net to get a copy of this message
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: r.j.michell@apu.ac.uk w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #-------------------------------------------------------#

« previous php.db (#9090) next »