Home > Backend Development > PHP Tutorial > sql在页面执行不通过解决方法

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

WBOY
Release: 2016-06-13 13:31:59
Original
830 people have browsed it

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)--
Copy after login



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);
?>

Copy after login


很莫名,求解

------解决方案--------------------
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)")
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template