Issue while fetching data from wordpress database using sql query
-
Hi,
I am new with the wordpress. I do have some knowledge about php and mysql. I am trying to create a function in function.php of my theme files. Its a very simple function however I am unable to figure it out why it is giving only single record in output.
Description about function: I have created one table in wordpress database and trying to retrieve number of records from that table.
Here is the function I created.
function my_posts()
{
global $wpdb;$checkpost = $wpdb->get_row(“SELECT record_content FROM
wp_my_postsWHERE my_ID = ’15′”);foreach($checkpost as $mypost_content)
echo $mypost_content;}
Here my_ID is not unique it has multiple records and I want to show those multiple records as a output of a query. Currently is showing up only first record in the output.
Can any one help me out here.
-
You did not specify a blog address or reason for posting when you created this topic.
This support forum is for WordPress.com hosted blogs only. If you have a self-hosted WordPress blog you need to seek help at the WordPress.org forums, not here.
If you don’t understand the difference, you may find this information helpful.
-
- The topic ‘Issue while fetching data from wordpress database using sql query’ is closed to new replies.