<script type="text/javascript">
var category = new Array("category1", "category2");
</script>
我的问题是,我有这个 PHP 查询:
<?php $query = mysql_query("SELECT category FROM table ORDER BY category DESC") or die(mysql_error());
while($sql = mysql_fetch_assoc($query))
{
echo $sql['category'];
}
?>
如何添加 $sql['category'] 作为 javascript "category" 的参数?