I am using code that used to work... I am trying to connect to a database to
validate a logon. I get a user ID and password from an HTML file, passed to
my PHP script. It fetches the query, but it always returns 1, even if I pass
a password that is invalid. The query does not get returned to PHP properly.

I had PHP spit out the SQL string it uses and I pasted it into my MySQL
administrator and executed it to perfection.

I also checked my mysqld.log file and noted that mySQL is in fact executing
the query properly when PHP asks it to, and it is executing the proper
query, PHP just does not get the proper data back. I know the SQL server is
fine, because other databases work, and even other PHP code works, but this
snippet won't.

I can connect to the CANNON datasbase through Microsoft Access and myODBC,
so the data is fine.

Any assistance would be greatly appreciated.


echo "<br>[$DBConn]<br>";
@mysql_select_db("CANNON",$DBConn) || DIE("Cannot select Database X");

$uid = $HTTP_POST_VARS["userid"];
$pwd = $HTTP_POST_VARS["password"];

$strSQL="Select UserID,Password From Users Where Active<>0 AND UserID='$uid'
AND Password='$pwd'";
$result = @mysql_query("Select * From Users") || DIE ("<br><b>Could not
query database...</b>");
$count=@mysql_num_rows($result) || DIE("Could not count records in
recordset"); //ERROR HERE
if ($count == 0)
$FinalTag="<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"0;URL=login.htm\">";
$FinalTag="<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"0;URL=test.php\">";
if ($x==1)
echo $FinalTag;
//echo $FinalTag;

PHP Development 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