Hi..
I have created custom tables in WP database and now want to retrieve the data and display them in the required fields. Like I have one table named flipcountries which have a number of countries name and they are to be displayed in a drop-down field so that user can select one of them.
I have read about wpdb class and all the references but still not able to display the content.
Please help how to loop the results..Code I used is:
<?php
global $wpdb;
$countries = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb
->wp_flipcountries"));
foreach ($countries as $country) {
$country->country;
echo "<option value=country>country</option>"; }
?>
here country is the second column in flipcountries table.
I am not sure what should be the code inside foreach loop..
Any help will be appreciated.
Thank you