自动在正文中添加垃圾文本,并在SQL查询开始时添加该文本

问题描述 投票:0回答:1

我想尝试在PHP 7中执行查询

$sql ="SELECT * from order_details where order_id = '".$order_number."' 
     AND product_id=".$pro['pruduct_id'].";

$select = mysqli_query($connection,trim($sql)) or die("Query(Get Shipments) is not executed."); 

我在SQL查询开始时得到了以下字符串类型,由于添加了这种字符串,我的sql查询无法执行。我也使用了trim()和字符串替换功能,但未执行SQL查询。

enter image description here

php php-7
1个回答
0
投票

这是因为您在那里有语法错误

尝试一下:

$sql ="SELECT * from order_details where order_id = '".$order_number."' AND product_id='".$pro['pruduct_id']."'";

$select = mysqli_query($connection, trim($sql)) or die("Query(Get Shipments) is not executed.");
© www.soinside.com 2019 - 2024. All rights reserved.