Jump to content

Recommended Posts

Hey everybody, I have searched the entire internet pretty much to try and figure out why this code doesn't work.

It used to work, but once I moved it to another server it gives me this error:

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in

 

Here is the code:

$requests = mysql_query("SELECT * FROM users, friendrequests WHERE touser='$username' AND fromuser=username ORDER BY requestid ASC"); 
while($reqs = mysql_fetch_array($requests)){


}

if anybody could help me...

 

It seems to not want to connect to multiple databases at all. Could it be a php.ini thing?

 

I'm using XAMPP 1.7.2 btw, all the new xampps error out like crazy

 
Link to comment
https://forums.phpfreaks.com/topic/281620-boolean-error/
Share on other sites

Temporarily use

 

$requests = mysql_query("SELECT * FROM users, friendrequests WHERE touser='$username' AND fromuser=username ORDER BY requestid ASC") or die(mysql_error());
and find out why your query failed. (Which is what happened.)

 

Also,

1. The mysql extension and mysql_* functions are dead. Switch to mysqli or PDO.

2. Use a real JOIN instead of the comma.

SELECT fields FROM users JOIN friendrequests ON whatever conditions to join them together WHERE the rest of your conditions... ORDER BY requestid ASC

I'm using XAMPP 1.7.2 btw, all the new xampps error out like crazy

Good. It's telling you about all the things going wrong. Edited by requinix
Link to comment
https://forums.phpfreaks.com/topic/281620-boolean-error/#findComment-1447092
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.