0

i hope someone can help me.

If i use my script, i get this error:

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, null given in
..../includes/cron/sourcebans/sourcebans.php on line 171

Here is the Code from this line:

// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
$res = $vbulletin->db->query_read("SELECT `username`, `user`.`userid` as userid,
`usergroupid`, `membergroupids`, `email`, `".$steamid_custom_field."` FROM ".
TABLE_PREFIX ."user LEFT JOIN `". TABLE_PREFIX ."userfield` ON 
user`.`userid`=`userfield`.`userid`");
while($row = mysql_fetch_assoc($res))
{

I don´t know, what the problem and i hope someone can help me to resolve it.

Thanks.

EDIT:

I don´t know, what to do... here is the full code: http://pastebin.com/PzQcd8Yt

  • possible duplicate of [mysql\_fetch\_array() expects parameter 1 to be resource, boolean given in select](http://stackoverflow.com/questions/2973202/mysql-fetch-array-expects-parameter-1-to-be-resource-boolean-given-in-select) – John Conde Jan 29 '14 at 14:36
  • You're using vbulletin's API to call the query (`$vbulletin->db->query_read`), so why don't you use the same API to get the results. Maybe vbulletin doesn't use `mysql_query()` internally, in which case `mysql_fetch_assoc()` is never going to work. – Spudley Jan 29 '14 at 14:55

1 Answers1

0

For some reason the call to query_read failed, and so $res is null. You need to figure out what went wrong in query_read, but I'm not familiar with the architecture you're using so I can't tell you how to find error messages.

Andy Lester
  • 91,102
  • 13
  • 100
  • 152