liniey rahman

liniey rahman

  • NA
  • 6
  • 5.4k

How to display records from database in php?

Dec 16 2013 7:43 AM
Hello, sir.

i need your help.
im using php, want to display hotels record in table from database.
the records are displayed in order by "bestprice", the lowest price will be upper.

plss..help me.

Thanks,
Liniey

----------------------------------------------------------------------------------------
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>


<body>
  <p>&nbsp;</p>
  <div class="warna">
  <table border="1">
 <tr>
   <th width="300">Hotel Name</th>
   <th width="72">Stars Rating</th>
   <th width="100">Agoda (RM)</th>
            <th width="100">Asiarooms (RM)</th>
   <th width="100">Booking (RM)</th>
   <th width="100">Expedia (RM)</th>
            <th width="110">Best Price (RM)</th>
   </tr>
 <tr>
   <?php
        global $wpdb;
        $result = $wpdb->get_results ( "SELECT * FROM cyberjaya" );
        foreach ( $result as $print )   {
            echo '<td>' $print->hotelname.'</td>';
            }
      ?>
   </tr>
   </table></td>
<td width="11%" bgcolor="#33FF99">&nbsp;</td>
</tr>
</table>
      <p>
      <input type="reset" name="reset" value="Back" onClick="window.location='index.html'";>
    </p>
  </div>
<p>
  <form action="index.html" method="post">
  </p>
</body>
</html>
----------------------------------------------------------------------------------------

Answers (2)