为了账号安全,请及时绑定邮箱和手机立即绑定

PHP - sql字符串之间的空格

PHP - sql字符串之间的空格

PHP
LEATH 2022-07-16 18:39:14
当我运行我的代码时,我收到此错误:WordPress-databaseerror 你的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在“fromwpiy_veosoft_crm_customerwhere Id = 957”附近使用正确的语法 $wpdb->prepare("select * from".$this->tables->tableCustomer()."where Id = %d", $data_id), ARRAY_A我试图在 from 和 " 和 where 之前创建空格,但是当我这样做时,它没有意识到它是一个 sql qurrie。我希望它看起来像这样并且可以工作,但是我已经尝试过了,但我没有$wpdb->prepare("select * from ".$this->tables->tableCustomer()." where Id = %d", $data_id), ARRAY_A
查看完整描述

1 回答

?
忽然笑

TA贡献1806条经验 获得超5个赞

试试下面的代码:


$data_id = 957;

$prepare = $wpdb->prepare("SELECT * FROM " . $this->tables->tableCustomer() . " WHERE Id = %d", $data_id);

$wpdb->get_results($prepare, ARRAY_A);

希望能帮到你。


查看完整回答
反对 回复 2022-07-16
  • 1 回答
  • 0 关注
  • 88 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信