Dave M G wrote:

PHP List,

I have a few scripts that have been around for a while. In one, is a simple login function:

$query = "SELECT * FROM forum_members WHERE memberName = '" . $username . "' AND passwd = MD5('" . $password . "')";
$result = mysql_query($query);

This was working fine, but recently I haven't been able to log in. I think the only thing that has changed is that on my hosting service, they recently upgraded to PHP 5.1.6. (MySQL is 4.1.21, but I think it's been that for quite a while)

Perhaps you have error reporting turned off. Errors or warnings may be generated but not displayed. Add the following to the top of your program to temporarily see the error messages:

error_reporting(E_ALL);

Also check in php.ini to make sure that

You may also want to see if any MySQL errors are being generated. Try the following code:

$result = mysql_query($query)
     or die("Query failed: ".mysql_error());

With this code, if the query fails, the program will stop and an error message will be displayed.

You also may want to display $query before you execute it to see what, exactly, is being executed.

Janet





Is there any potential for PHP 5.1.6 to handle things different when it comes to MySQL queries, post data, or anything? I thought it might be that I still had $HTTP_POST_VARS for some of my variables, but I changed them all to $_POST, and it still doesn't work.

I don't get any errors or anything. My own code is not very sophisticated for error reporting. But I'm not getting any PHP syntax errors of any kind. If I run the SQL code by itself at an SQL command prompt, I get results back, so I don't think the SQL is failing.

Are there any gotchas in the upgrade that I might be missing? I can't think of anything else that could be a culprit (though of course I'm open to suggestions).

Any advice would be much appreciated.

--
Dave M G
Ubuntu 6.06 LTS
Kernel 2.6.17.7
Pentium D Dual Core Processor
PHP 5, MySQL 5, Apache 2



--
Janet Valade -- janet.valade.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to