Php not working...

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Php not working...

Postby WillAugust » 13. September 2009 13:21

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. :)
WillAugust
 
Posts: 2
Joined: 13. September 2009 13:15

Re: Php not working...

Postby sili » 13. September 2009 14:45

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.
sili
 
Posts: 67
Joined: 15. March 2003 16:05

Re: Php not working...

Postby WillAugust » 13. September 2009 15:00

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
WillAugust
 
Posts: 2
Joined: 13. September 2009 13:15

Re: Php not working...

Postby sili » 13. September 2009 15:46

mysql_query() returns FALSE on error. Did you start MySQL and are other DB connections working?
sili
 
Posts: 67
Joined: 15. March 2003 16:05

Re: Php not working...

Postby dmphotography » 13. September 2009 18:22

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.
For great video and written tutorials and guides on creating your own web server and installing things such as forums, blogs, etc., visit http://myownhomeserver.com
dmphotography
 
Posts: 191
Joined: 15. December 2008 14:25
Location: Columbus, MS
Operating System: Windows 7

Re: Php not working...

Postby Altrea » 13. September 2009 23:47

Output MySQL errors is always a best practice for debugging :mrgreen:
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8293
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 71 guests