关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。
想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。
4年前关闭。
Improve this question
我正在尝试通过 Wordpress 运行 mysql_fetch_array。我发现最好的方法在这里解释:http://codex.wordpress.org/Class_Reference/wpdb#SELECT_Generic_Results
这是我的查询如下:
$sql = "SELECT * FROM wp_reminders WHERE reminder LIKE '$today'";
$result = $wpdb->get_results($sql) or die(mysql_error());
foreach( $result as $results ) {
echo $result->name;
}
即使数据确实存在,上述内容也根本没有得出任何结果。任何想法我做错了什么?
最佳答案
问题如下:
echo $result->name;
应该:
echo $results->name;
关于Wordpress $wpdb->get_results() 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14800411/