Numbers to yes/no
Posted: Mon Feb 27, 2012 11:52 am
Right I have the following PHP code that pulls from our database and displays customer contact info along side their name. What i am trying to do is pull in the cover table and put it as yes/no for if they are under our cover or not. the database holds their level of cover as 0= no cover to 5= highest cover etc, i am wanting to put these in a table which as you can see works but at the moment just displays the numbers.
I have tried verious code snipetts from the internet but as i know very little about PHP i have suprised meself getting this far....
This is the current code i have:
Any help appreciated.
I have tried verious code snipetts from the internet but as i know very little about PHP i have suprised meself getting this far....
This is the current code i have:
Code: Select all
<?php include ("header.php"); ?>
<a href="menu.php">Back</a>
<?php
// Get all the data from the "example" table
$result = mysql_query("SELECT * FROM customers WHERE Status>0 && Level>=" . $_SESSION['eng_level'] . " ORDER BY Name ASC")
or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th>Name</th> <th>Phone Number</th> <th>on Cover</tr> </tr> ";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['Name'];
echo "</td><td>";
echo $row['TelephoneNo'];
echo "</td><td>";
echo $row['Cover'];
echo "</td></tr>";
}
echo "</table>";
?>