I wonder if anyone can help - I want to select a table and create Javascript a array with the return values. Here's what I have so far:
con = mysql_connect("localhost","usrname","password");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);
$ql = "SELECT theMessage FROM email_message";
$result = mysql_query($ql) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$allMessage = $row['theMessage'] . " ";
}
$arr = array($allMessages);
$script = '<script>var newArr = new Array(' . implode(' ', $arr) . ');</script>';
echo $script;
But instead, it just shows me empty array like this: var newArr = new Array();