Hello;
can anyone help me out and show me how to get rid of these errors:
Warning: array_unique(): The argument should be an array in /home/www/immunizewny.org/index5.php on line 132
Warning: array_unique(): The argument should be an array in /home/www/immunizewny.org/index5.php on line 134
Warning: sort() expects parameter 1 to be array, boolean given in /home/www/immunizewny.org/index5.php on line 136
Warning: sort() expects parameter 1 to be array, boolean given in /home/www/immunizewny.org/index5.php on line 138
Warning: Invalid argument supplied for foreach() in /home/www/immunizewny.org/index5.php on line 156
Warning: Invalid argument supplied for foreach() in /home/www/immunizewny.org/index5.php on line 165
Here is index.php-thanks for any help.
<?php
// Connection to the db server and select active db
$SQLlink = @mysql_connect("13.com", "nyaic", "jn"); //creates a connection
if (!$SQLlink)
Die("Couldn't connect to the db server."); // display error message on error
if (!mysql_select_db("nyaic", $SQLlink))
Die("Couldn't access database."); // display error message on error
// perform query
$data = mysql_query("SELECT date, agency, city FROM agencies");
if (!$data)
Die(mysql_error()); // display MySQL error message on error
$agencies = Array();
while($row = mysql_fetch_array($data)) { // assign results into arrays
$dates[] = $row["date"];
$agencies[] = $row["agency"];
$cities[] = $row["city"];
}
$dates = Array_Unique($dates); // remove duplicate values
$agencies = Array_Unique($agencies);
$cities = Array_Unique($cities);
Sort($dates); // sort arrays
Sort($agencies);
Sort($cities);
$date_out = "<select name='date' onchange=\"window.open('results.php?action=date&value='+this.value, 'agencyWin', 'location=yes,left=20,top=20');\">";
$agency_out = "<select name='agency' onchange=\"window.open('results.php?action=agency&value='+this.value, 'agencyWin', 'location=yes,left=20,top=20');\">";
$city_out = "<select name='city' onchange=\"window.open('results.php?action=city&value='+this.value, 'agencyWin', 'location=yes,left=20,top=20');\">";
$date_out .= "<option>-- select date ---</option>";
$agency_out .= "<option>-- select agency ---</option>";
$city_out .= "<option>-- select city ---</option>";
forEach ($dates as $value)
$date_out .= "<option value='$value'>$value</option>";
forEach ($agencies as $value)
$agency_out .= "<option value='$value'>$value</option>";
forEach ($cities as $value)
$city_out .= "<option value='$value'>$value</option>";
$date_out .= "</select>\n";
$agency_out .= "</select>\n";
$city_out .= "</select>\n";
echo $date_out."";
echo $agency_out."";
echo $city_out."<BR>";
?>