[thelist] best way to check for valid user/password in PHP - oops 1 more qu..

Jason Handby jasonh at pavilion.co.uk
Thu Jan 9 14:02:01 CST 2003


> how do I get my row info later? Since I have to take out the
> @mysql_query() from my $result query..its now $result = "SQL here";
>
> So now, I can't use $row = mysql_fetch_array($result); to get my rows
> since $result isn't a valid query... I get this error:

Good question. I'm not a PHP expert, so at this point I'd modify the query
so that it always returns a result:

  SELECT COUNT(*) FROM reguser WHERE username = '$username' AND password =
'$password'

Then just check to see if it's returned a non-zero number of matches.

Of course there might be a better way of doing this in PHP!


J




More information about the thelist mailing list