gpt4 book ai didi

mysql - SHOW TABLES LIKE 上的语法错误

转载 作者:行者123 更新时间:2023-11-29 11:33:33 24 4
gpt4 key购买 nike

我不明白为什么它说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 ''User_notifications''关于此查询:

<?php
include 'constants.php';
$username=$_POST['username'];
$notiftable=$username.'_notifications';
$con=new mysqli('',databaseuser,databasepassword,database);
if($con)
{
$q="SHOW TABLES LIKE '$notiftable'";

最佳答案

您的表名User_notifications正在被双重转义(即它被转义两次)。这种情况很可能发生,因为 PHP 函数已经对其进行了转义,而您正在第二次执行此操作。尝试不要自己转义表名称,即:

 $q = "SHOW TABLES LIKE $notiftable";

关于mysql - SHOW TABLES LIKE 上的语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36996108/

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