After my host switched to PHP 5 I have received this error from a few different pages: 2: array_merge() [function.array-merge]: Argument #2 is not an array.
I read from somewhere that this is a common problem when updating to PHP5 but I couldn't figure out how to fix it. The code below is from yabbse, I have the same problem with couple of more scripts so it would be great if someone could help me how to fix it
function OptimizeTables()
{
global $db_name, $webmaster_email, $txt, $yytitle;
$message = '';
$yytitle = $txt['yse281'];
template_header();
$query = "SHOW TABLE STATUS FROM `$db_name`";
$get_tables = mysql_query($query) or database_error(__FILE__, __LINE__);
$num_tabs = mysql_num_rows($get_tables);
$output_handling = array();
$mail_message = array();
$head = $txt['yse282'] . $num_tabs . ' ' . $txt['yse282b'];
$output_handling = array($head);
if(0 < $num_tabs)
{
$x = $txt['yse283'];
$output_handling = array_merge($output_handling, $x);
$k = 0;
$i = 0;
while($table = mysql_fetch_array($get_tables))
{
$tableName = mysql_tablename($get_tables, $i);
$datalength = $table['Data_length'];
$indexlength = $table['Index_length'];
$length = $datalength + $indexlength;
$length = $length / 1024;
$length = round ($length, 3);
$freedata = $table['Data_free'];
$freedata = $freedata / 1024;
$freedata = round ($freedata, 3);
//optimize
$query = "OPTIMIZE TABLE ".$tableName;
$resultat = mysql_query($query) or database_error(__FILE__, __LINE__);
if($freedata == 0)
$k++;
else
{
$x = "optimize: $tableName .... $freedata $txt[yse284]\n";
$output_handling = array_merge($output_handling, $x);
$mail_message = array_merge($mail_message, $x);
$opttab++;
}
$i++;
}
$cnt = $num_tabs - $k;
if($cnt == 0)
$output_handling = array_merge($output_handling, '<br />' . $txt['yse285']);
else
{
$x = "<br /> " . $opttab . $txt['yse286'];
$output_handling = array_merge($output_handling, $x);
}
} // end if
echo "<br /><br />";
$ret = array_values($output_handling);
foreach ($ret as $var)
echo "$var<br />";
$ret = array_values($mail_message);
$array_cnt = count($mail_message);
foreach ($ret as $var)
$message .= $var;
if($array_cnt == 0)
$message = $txt['yse285b'];
//mail($webmaster_email, $txt['yse281'], $message, "From: $webmaster_email\r\n");
footer();
obExit();
}