Michael Southwell wrote:
Quoting PaulCheung <[EMAIL PROTECTED]>:
I have researched, checked and tried everything I can think of and
still cannot get it to work.
SELECT access_code FROM authorised_users WHEN
I am not familiar with WHEN but that could be my own ignorance
$rs = @mysql_select_db( "test_db", $conn )
or die( "Could not select database" );
$rs = @mysql_select_db( "test_db", $conn ) or die( "Could not select
database" );
This line is doubled but that is not your problem.
$sql = "SELECT access_code
FROM authorised_users
user_id = '$userid' AND
This is the reason that you are getting different results: you left out
the WHEN that you had above (unless this is not an accurate
representation of your code); whether WHEN is a legitimate keyword is a
different issue.
AFAIK that WHEN should be a WHERE. Also, the one ID is put in single
quotes within the query. Better is sth like this if in case IDs are integers
$sql = "SELECT access_code FROM authorised_users WHERE user_id =
".$userid." AND ....
Not that this is the reason for failure, but I found it somewhat
difficult to follow the code as there are absolutely no comments. Add
commentary, at least one comment per two lines of code. That helps to
understand what you are doing and what the steps are, even for something
basic like this.
David
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php