Array problem

[php]<?

require ‘…/includes/accounting.php.inc’;
require ‘…/includes/config.php.inc’;

$pkgs = listpkgs($host,$user,$accesshash,0);

ksort($pkgs);

$counter=‘0’;

?>

Auto Host Manager

Add New Packages

<? foreach($pkgs as $package => $space){
		$checkexist = mysql_query("SELECT * FROM tblPackages WHERE pkgv='$package'");
		$chknum = mysql_numrows($checkexist);

	if ($chknum==0) {

            	echo "<TR><TD WIDTH=200>$package</TD><TD WIDTH=200><input type='text' name='".$package."' size=30></TD><TD WIDTH=150>$<input type='text' name='pr".$package."' size='10'></TD></TR>";
		$counter++;

	}

       	}

if ($counter==0) {

echo "<TR><TD COLSPAN='3'>There are no new packages available on your server.</TD></TR>";

} else {
?>

<?};?>
cPanel Name Package Display Name Package Price



Back to Control Panel

[/php]

Warning: ksort() expects parameter 1 to be array, null given in /home/q8hoster/public_html/admin/addpack.php on line 8

Warning: Invalid argument supplied for foreach() in /home/q8hoster/public_html/admin/addpack.php on line 41

Im getting those 2 errors coudlnt find a way to solve them.

I would really appreciate your help guys :smiley:

whatever listpkgs is returning, its not an array, which is what ksort and the foreach loop require. I would have a look at the the function first, make sure its returninan array.

Sponsor our Newsletter | Privacy Policy | Terms of Service