1
我有以下网址PHP页面:
http://xyz.com/dev/gallery.php?k=1&s=35
下面的JavaScript文件包含在PHP页面:
<script type="text/javascript" src="js/some-js-file.php"></script>
的一些-JS -file.php需要使用PHP动态填充:
jQuery(function($){$.supersized({
<?php
$sql = "SELECT * FROM tbl WHERE id=".$_GET['s']." ORDER BY pos ASC";
$result = mysql_query($sql);
while($rs = mysql_fetch_row($result)){
...do some output here...
}
?>
});
});
由于某些原因,$ _GET ['s']为空。任何想法为什么?预先感谢任何帮助!
**危险**:您正在使用[an **过时的**数据库API](http://stackoverflow.com/q/12859942/19068)并应使用[现代替换](http:// php.net/manual/en/mysqlinfo.api.choosing.php)。你也**易受[SQL注入攻击](http://bobby-tables.com/)**,现代的API会使[防御]更容易(http://stackoverflow.com/questions/60174/best-way-to-prevent-sql-injection-in-php)自己从。 – Quentin