Hi I have A newbie question. if id == 1 then display the commercial name that has a value of 1 follow by all the value from database then else when id == 0 display all the value..
I try this but not working please help me..
$mod_query = "SELECT * FROM ";
$mod_query .= "fm_third_party ORDER BY commercial_name asc";
$mod_result = mysql_query($mod_query) or die(mysql_error());
$cname = array();
while ($row = mysql_fetch_assoc($mod_result))
{
$cname = $row['id'];
$ids = $row['id'];
}
if ($ids == 1)
{
echo "<option>$cname</option>";
do {
?>
<option value="<?php echo $row_rsTP['third_party_id']?>"
<?php if (!(strcmp($row_rsTP['third_party_id'], $row_ap['company_co']))) {echo "SELECTED";} ?>><?php echo $row_rsTP['commercial_name'] ." - ".$row_rsTP['date_expire'] . " - " .$row_rsTP['ao_id'];?></option>
<?php
} while ($row_rsTP = mysql_fetch_assoc($rsTP));
$rows = mysql_num_rows($rsTP);
if($rows > 0) {
mysql_data_seek($rsTP, 0);
$row_rsTP = mysql_fetch_assoc($rsTP);
}
}
else
{
$mod_query1 = "SELECT * FROM ";
$mod_query1 .= "fm_third_party ORDER BY commercial_name asc";
$mod_result1 = mysql_query($mod_query1) or die(mysql_error());
while ($row1 = mysql_fetch_assoc($mod_result1))
{
echo "<option value=".$row1['third_party_id'].">".$row1['commercial_name']. " </option>";