0 レビュー
0 回答
php-WPデータベースを照会する際の問題
WPデータベースにクエリを実行しようとすると、次のエラーが発生します。
「ここのパス」にある非オブジェクトのメンバー関数get_results()を呼び出します
これが私が実装しようとしているコードです:
global $wpdb; /* wpdb class should not be called directly.global $wpdb variable is an instantiation of the class already set up to talk to the WordPress database */ $result=$wpdb->get_results("SELECT * FROM wp_posts "); /* multiple row results can be pulled from the database with get_results function and outputs an object which is stored in $result */ //echo "<pre>"; print_r($result); echo "</pre>"; /* If you require you may print and view the contents of $result object */ echo "ID" . " " . "post_title" . "<br><br>"; foreach ($result as $row) { echo $row->id . " " . $row->name . "<br>"; } /* Print the contents of $result looping through each row returned in the result */
わからない
同様の質問
私たちのウェブサイトで同様の質問で答えを見つけてください。