Jump to content

php and mysql array problem, empty array help


jjcanales

Recommended Posts

I am still learning php and mysql. I am able to log into my mysql database and get the emails I need from the database, I can even get the correct ones to show that match the variables,  but if the array returns with nothing, then I get a blank screen.  I am trying to get it to tell me the array is blank and end the script when it is.  I already know that when there are emails it will put them into my array. Any help appreciated.  See what I have below.  Thanks.

Joe

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db($dbname);


$query  = "SELECT email FROM users WHERE subscribepage = '$location_value' AND confirmed = 1 AND blacklisted = 0";
$result = mysql_query($query);


while (($row = mysql_fetch_array($result)) !== false){
      $ADMIN_EMAILS[] = $row['email'];

if (empty($email)){
  echo "Sorry, we do not have anybody in your city at this time";
  end;
}

mysql_close($conn); 
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.