$wpdb custom table pagination
-
Good Morning,
I wondering if someone can help. I want to paginated my results from a custom table in wordpress.
This is my query. I want to be able to limit the number of hotels on a page and then paginate it to the next page.
global $wpdb;
$myrows = $wpdb->get_results( “SELECT * FROM hotels WHERE cat=’hotel'”, OBJECT);
if ($myrows) {
foreach ( $myrows as $hotel ) {
echo “<table width=’100%’ align=’center’ border=’3px solid grey’>”;
echo”<tr>”;
echo”<th>Picture</th>”;
echo “<th>Details</th>”;
echo “<th>More Info</th>”;
echo “</tr>”;
echo “<tbody>”;
echo “<tr>”;
echo “<td><img src=images/$hotel->pic’ alt=’$hotel->name’/></td>”;
echo “<td><h1>{$hotel->name }</h1><h3>{$hotel->address}</h3><p class=\”tag\”>{$hotel->tag} id’>
More Info </p></td>”;
echo “<td class=’contactd’><p class=\”price\”> From £$hotel->Price </p> Per Person Per Night
<p class=\”price\”>Contact Them On</p>{$hotel->contact}
<p class=\”price\”>Visit their Website </p>website’>{$hotel->website}</td>”;
echo “</tr>”;
echo “</tbody>”;echo “</table>”;
I would appreciate it if someone could help or point to a tutorial or plugin.
Thanks
- The topic ‘$wpdb custom table pagination’ is closed to new replies.