jokerfool Posted January 2, 2009 Share Posted January 2, 2009 I am getting this error and I don't know what it means, the script has no support behind it so I have come here, can someone tell me what this means please: [02-Jan-2009 11:45:31] PHP Warning: array_merge() [<a href='function.array-merge'>function.array-merge</a>]: Argument #2 is not an array in /home//includes/load_category.php on line 26 The line 26 refers to this line: $en = array_merge($en,$line); The line 26 is made up of this section: //Find Category $parent = 0; $url = ''; $path = '<a class=title_links href="'.constant('dir').'">'._home.'</a>'; while (count($cats) > 0) { $cat = array_shift($cats); $result = mysql_query("SELECT * FROM $catstable WHERE c_parent=$parent AND c_url='".$cat."'") or die(mysql_error()); $line = mysql_fetch_assoc($result); $en = array_merge($en,$line); if (mysql_num_rows($result) == 0) call404(); $parent = $line[c_id]; $url .= '/'.$line[c_url]; if (substr($url,0,1) == '/') $url = substr($url,1); $path .= ' : <a class=title_links href="'.constant('dir').$url.'">'.$line[c_name].'</a>'; } Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/139234-array_merge-help-please-confused/ Share on other sites More sharing options...
flyhoney Posted January 2, 2009 Share Posted January 2, 2009 It looks like that database query is returning an empty result Quote Link to comment https://forums.phpfreaks.com/topic/139234-array_merge-help-please-confused/#findComment-728286 Share on other sites More sharing options...
flyhoney Posted January 2, 2009 Share Posted January 2, 2009 Switching these two lines might solve the problem: change: $en = array_merge($en,$line); if (mysql_num_rows($result) == 0) call404(); to: if (mysql_num_rows($result) == 0) call404(); $en = array_merge($en,$line); Quote Link to comment https://forums.phpfreaks.com/topic/139234-array_merge-help-please-confused/#findComment-728287 Share on other sites More sharing options...
jokerfool Posted January 2, 2009 Author Share Posted January 2, 2009 Okay will leave this for about an hour then reply and see what errors I am generating, thank you. Quote Link to comment https://forums.phpfreaks.com/topic/139234-array_merge-help-please-confused/#findComment-728292 Share on other sites More sharing options...
jokerfool Posted January 2, 2009 Author Share Posted January 2, 2009 Whilst I wait for the errors to appear there I am getting another error elsewhere, same array message: PHP Warning: array_merge() [<a href='function.array-merge'>function.array-merge</a>]: Argument #2 is not an array in /home/admin/includes/manage_members.php on line 257 The line refers too: $ll = mysql_fetch_assoc($res); $line = array_merge($line,$ll); That section refers too this: //$line = mysql_fetch_array($result,MYSQL_ASSOC); //foreach ($line as $key=>$value) echo $key.'='.$value.'<br>'; while ($line = mysql_fetch_array($result,MYSQL_ASSOC)) if (++$npk >=$from && $npk<=$to) { $res = mysql_query("SELECT COUNT(l_id) AS listings FROM $linktable WHERE l_member=$line[$rid]") or die(mysql_error()); $ll = mysql_fetch_assoc($res); if (is_Array($ll)) { $line = array_merge($line,$ll); } $res = mysql_query("SELECT COUNT(r_id) AS reviews FROM $reviewtable WHERE r_member=$line[$rid]") or die(mysql_error()); $ll = mysql_fetch_assoc($res); $line = array_merge($line,$ll); $res = mysql_query("SELECT COUNT(log_user) AS logins FROM $logstable WHERE log_user=$line[$rid]") or die(mysql_error()); $ll = mysql_fetch_assoc($res); $line = array_merge($line,$ll); $res = mysql_query("SELECT log_time AS lastlog, log_ip AS lastip FROM $logstable WHERE log_user=$line[$rid] ORDER BY log_time DESC LIMIT 1") or die(mysql_error()); $ll = mysql_fetch_assoc($res); $line = array_merge($line,$ll); Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/139234-array_merge-help-please-confused/#findComment-728301 Share on other sites More sharing options...
jokerfool Posted January 3, 2009 Author Share Posted January 3, 2009 Any suggestions please? Quote Link to comment https://forums.phpfreaks.com/topic/139234-array_merge-help-please-confused/#findComment-728619 Share on other sites More sharing options...
sasa Posted January 3, 2009 Share Posted January 3, 2009 try if($ll = mysql_fetch_assoc($res)) $line = array_merge($line,$ll); Quote Link to comment https://forums.phpfreaks.com/topic/139234-array_merge-help-please-confused/#findComment-728784 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.