sophielois
Technical User
hey,
I have a little problem i cant work out how to do the following
How do incorporate the below if statement into the mysql queery so that echo "<td>$row->level_2</td>"; will display "car 2" or "car 3" for every row
Sophiex
I have a little problem i cant work out how to do the following
Code:
<?php
$result = mysql_query("SELECT * FROM candidates ORDER BY Name ASC");
while($row = mysql_fetch_object($result))
{
echo "<tr>";
echo "<td>$row->first_name $row->last_name</td>";
echo "<td>$row->level_2</td>";
echo "<td>$row->reg_num</td>";
echo "<td>$row->wrk_place</td>";
echo "<td>$row->signup_date</td>";
echo "<td>$row->tel</td>";
echo "<td>$row->email_address</td>";
echo "<td>$row->ass_name</td>";
echo "<td>$row->iv_name</td>";
echo "<td><a href=\"/admin/can/canedit.php?userid=$row->userid\">View</a></td>";
echo "</tr>";
}
?>
How do incorporate the below if statement into the mysql queery so that echo "<td>$row->level_2</td>"; will display "car 2" or "car 3" for every row
Code:
<?
if ($row->level_2 == 1) {
echo "Car 2";
} else{
echo "Car 3";
}
Sophiex