當我運行我的代碼時,我收到此錯誤: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);
希望能幫到你。
- 1 回答
- 0 關注
- 121 瀏覽
添加回答
舉報
0/150
提交
取消