jeudi 23 juin 2016

Dynamic Tables in PHP

The following code works fine and it gives the required output: <a target="_blank" href="' . $property_post_link . '" style="color:#f8953a;font-size:18px;margin-left:0px;text-decoration:none"><b>' . $property_name . '</b></a> <div style="color:#f8953a;font-style:italic"> <!--- <span style="font-weight:bold;">Transaction Type: </span>' . $transaction_type . ' ---> <!--- <span style="font-weight:bold;padding-left:5px;">Category: </span>' . $newprop_category . ' ---> </div> <div style="color:#f8953a;font-style:italic"> <span style="font-weight:bold">Property Type: </span>' . $proper_type . ' <span style="font-weight:bold;padding-right:5px;">BHK: </span>' . $bhk . ' <span style="font-weight:bold;padding-left:5px;">Status: </span>' . $status . ' </div> <div style="color:#f8953a;font-style:italic"> <span style="font-weight:bold">Location: </span>' . $loc . ' <span style="font-weight:bold;padding-right:5px;">Building Name: </span>' . $buildingname . ' <span style="font-weight:bold;padding-left:5px;">No. of Floor: </span>' . $no_floor . ' </div> <div style="color:#f8953a;font-style:italic"> <span style="font-weight:bold">Carpet Area: </span>' . $carpet_area . ' <span style="font-weight:bold;padding-right:5px;">Built up Area: </span>' . $buildup_area . ' <span style="font-weight:bold;padding-left:5px;">Price: </span>' . $price_options_select . ' </div> <div style="color:#f8953a;font-style:italic"> <span style="font-weight:bold">Contact Person: </span>' . $contactperson . ' </div> But I need to get this in a table. I am using the following code: echo "<table border='1'> <tr><th>Building</th><th>Location</th><th>BHKs</th><th>Built up Area</th><th>Furnishing</th><th>Quote</th><th>Advance Rent</th><th>Deposit</th><th>Parking</th></tr>"; foreach ($the_rows as $the_row) { echo "<tr><td>" . $the_row->buildingname . "</td>"; echo "<td>" . $the_row->loc . "</td>"; echo "<td>" . $the_row->bhk . "</td>"; echo "<td>" . $the_row->buildup_area . "</td>"; echo "<td>" . $the_row->interior_options_select . "</td>"; echo "<td>" . $the_row->price . "</td>"; echo "<td>" . $the_row->advrent . "</td>"; echo "<td>" . $the_row->deposit . "</td>"; echo "<td>" . $the_row->car_parking . "</td></tr>"; } echo "</table>"; But this is not fetching the results from the database. Any help is appreciated.

Aucun commentaire:

Enregistrer un commentaire