Hi,
I'm trying to list facilities available for a particular hotel horizontally, separated by a comma, within the <td> element of a table.
The facilities are type ENUM and have a value of '1' if available and '0' if not.
NonSmoking, AirCon and Restaurant are field names in the table (There is the possibility of up to 40 facilities to be displayed)
Any suggestion what I'm doing wrong? The code works apart from the bold section.
Thanks.
<?php
include 'connect.php';
// Execute the SQL query and return records
$result = mysql_query("SELECT * FROM tablename WHERE id = 1234");
while ($row = mysql_fetch_array($result)) {
echo "<table width=\"75%\" align=\"center\" cellpadding=\"0\" cellspacing=\"2\">\n";
echo " <tr>\n";
echo " <td class=\"hotelinfohead\">Facilities</td>\n";
echo " </tr>\n";
echo " <tr>\n";
[B]echo " <td class=\"hotelinfotext\">
if ($row[NonSmoking] = 1) {
echo 'Non smoking rooms available, ';
}
if ($row[AirCon] = 1) {
echo 'Air conditioning, ';
}
if ($row[Restaurant] = 1) {
echo 'Restaurant, ';
}
</td>\n";[/B]
echo " </tr>\n";
echo "</table>";
}
?>