Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql $wpdb:选择。。。哪里_Sql_Wordpress - Fatal编程技术网

Sql $wpdb:选择。。。哪里

Sql $wpdb:选择。。。哪里,sql,wordpress,Sql,Wordpress,当我使用它时,它运行良好,我没有问题: $user = $_POST['uusername']; $result=$wpdb->get_results("SELECT * FROM Materials"); foreach($result as $print) { echo '<pre>',print_r($print->id_customer,1),'</pre>'; } $wpdb->print_error(); 此选择是否有任何错误?如果发布值为

当我使用它时,它运行良好,我没有问题:

$user = $_POST['uusername'];
$result=$wpdb->get_results("SELECT * FROM Materials");
foreach($result as $print)
{ echo '<pre>',print_r($print->id_customer,1),'</pre>'; }
$wpdb->print_error();

此选择是否有任何错误?

如果发布值为字符串传递单引号:


比你好多了:D
$user = $_POST['uusername'];
$result=$wpdb->get_results("SELECT * FROM Materials WHERE mtrname=$user");
$result=$wpdb->get_results("SELECT * FROM Materials WHERE mtrname='$user' ");