I am trying to loop array from database in email.php but i am getting this error:
Parse error: syntax error, unexpected ';', expecting ')' in /home/xxx/public_html
/email.php on line 62
This is the code in email.php:
$allowed_senders = Array(
$query = "SELECT email FROM members"; // Line 62
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result))
{
$loop_email = $row['email'];
echo "'".$loop_email."',";
}
);
I don’t understand what went wrong. Any help?
Your syntax is way off:
Please, don’t use
mysql_*functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi – this article will help you decide which. If you choose PDO, here is a good tutorial.