首页  >  文章  >  后端开发  >  sql在页面执行不通过解决方法

sql在页面执行不通过解决方法

WBOY
WBOY原创
2016-06-13 13:31:59769浏览

sql在页面执行不通过
sql语句在页面执行就报错,放到phpmyadmin执行正常

SQL code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->select * from bn_product where Id=4;create table abc(cmd varchar not null)--



PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?php require_once("config.php");
$Id=$_GET["Id"];
$me="select * from bn_product where Id=".$Id."";
$sql=mysql_query($me);
$myarr=mysql_fetch_array($sql);
?>



很莫名,求解

------解决方案--------------------
select * from bn_product where Id=4;create table abc(cmd varchar not null)--

这个?

mysql_query 不支持;多条语句。

请分开执行吧。
mysql_query("select * from bn_product where Id='4'")

mysql_query("create table abc(cmd varchar not null)")
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn