I am trying to fill arrays to use in my javascript codes as following
[code=php]
var codes = new Array (
<?php $sql1 = mysql_query(“SELECT * FROM produse order by cod ASC”) or die(mysql_error());
while($row1 = mysql_fetch_array($sql1))
{
echo ”’.$row1[“cod”].”,’;
}
?>’murat_’)
var clients = new Array (
<?php $sql2 = mysql_query(“SELECT * FROM magazalar order by shop_name ASC”) or die(mysql_error());
while($row2 = mysql_fetch_array($sql2))
{
echo ”’.$row2[“shop_name”].”,’;
}
?>’murat’)
This process doesnt return any results
But when i erase one of the arrays above, the other one works perfectly or in the second array when i intentionally change the part like
[code=php]while($row = mysql_fetch_array($sql2))
here i am intentionally write false code ($row instead of $row2)
Then i get the list for the 1st one as it is supposed to be
So what can be the error i am making here?