Page 1 of 1

Php not working...

PostPosted: 13. September 2009 13:21
by WillAugust
Hello!
I recently reinstalled a whole new OS and everything, and I reinstalled Xampp which all my files were working perfectly on before.

So it is installed, and in the status everything is fine except the three bottom things which i dont think i need.
But with the php, it doesn't work. Here is an example...
Remember, this was working fine before.

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\stw\userClass.php on line 338
Title: title[$i];?>

maybe it's a different PHP version? How do i change the php version if it is?

Thanks for help. :)

Re: Php not working...

PostPosted: 13. September 2009 14:45
by sili
You better change your code than your PHP version ;)
If you provide an example of code where the error occurs we could help you with that.

Re: Php not working...

PostPosted: 13. September 2009 15:00
by WillAugust
But it was definitely working before I reinstalled xampp...

Code: Select all
   $query = "SELECT * FROM $this->dbUserTable WHERE userName = '$username' AND password = '$password'";

   $result = mysql_query($query);
   while($row = mysql_fetch_array($result)){ <- line 338

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\stw\userClass.php on line 338

Re: Php not working...

PostPosted: 13. September 2009 15:46
by sili
mysql_query() returns FALSE on error. Did you start MySQL and are other DB connections working?

Re: Php not working...

PostPosted: 13. September 2009 18:22
by dmphotography
Yeah, it looks to me like your MySQL connection details, such as username and password aren't correct or your MySQL server isn't running.

Also make sure the database you are trying to query exists and has the same name as it did before as well as contains information and is not empty.

Re: Php not working...

PostPosted: 13. September 2009 23:47
by Altrea
Output MySQL errors is always a best practice for debugging :mrgreen: