Issue while fetching data from wordpress database custom table
-
Hi,
I am new with the wordpress. I do have some knowledge about php and mysql. I am trying to create a simple custom function using custom table in wordpress database. Its a very simple function. I am creating custom function in function.php. It is giving me output However I am unable to figure it out why it is giving only single record in output. It might be due to array, but I am week in using array in php.
Description about function: I have created one table in wordpress database and trying to retrieve number of records from that table (more than one record).
Here is the function I created.
function my_posts()
{
global $wpdb;$checkpost = $wpdb->get_row(“SELECT record_content FROM wp_my_posts WHERE 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.
The topic ‘Issue while fetching data from wordpress database custom table’ is closed to new replies.