gpt4 book ai didi

php - 使用连接在 php 中执行 sql 查询

转载 作者:行者123 更新时间:2023-12-03 23:11:31 33 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Mysql can't perform more than 1 query at a time

        $query = "TRUNCATE TABLE nw_world;";
$query = $query . " INSERT INTO `nw_world`";
$query = $query . " SELECT * FROM `x_world` WHERE x <0 AND y >=0";
$query = $query . " AND tid !=5 AND aid NOT IN ( 29, 908, 935, 941, 950 )";
$query = $query . " AND population <=50";

echo "$query";
mysql_query($query,$con) or die("error ".mysql_error());

这会导致错误

error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO `nw_world` SELECT * FROM `x_world` WHERE x <0 AND y >=0 AND tid !=5 ' at line 1

但是当我在 mysql 中执行相同的查询时,它工作正常。因此,我觉得我在 php 编码中犯了一些错误。请帮忙

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com