please help me
I want inside a javascript function to bring data from database using php and put them in javascript array so that I can use them later, example after that alert the array like that:
function lolo()
{
var p=0;
var id=new array();
<?
$sql1=mysql_query("select * from sanction s, student st, officer o where s.Id=st.Id and s.Oid=o.Oid",$db);
while($row = mysql_fetch_array($sql1, MYSQL_NUM))
{?>
id[p]=<?=$row["Id"]?>;
p=p+1;
<?
}?>
var x=0;
for(x=0; x<=p; x++)
{
alert(id[x]);
}
}
this is the function but unfortunately not working any help!!!!!!!!
|