Scroll to top

How to fetch data from database in wordpress?

<table border="1">
<tr>
<th>Name</th>
<th>Phone no.</th>
<th>city</th>
</tr>
<tr>
<?php
global $wpdb;
$result
= $wpdb->get_results ( "SELECT * FROM myTable" );
foreach ( $result as $print ) {
echo
'<td>' $print->firstname.'</td>';
}
?>
</tr>
</table>

Leave a Reply

Your email address will not be published.