Display a row when another one is Not Null?

A

Anonymous

Guest
Try this:

Code:
// Display listing 
while ( $row = mysql_fetch_array($result) ) { 
echo("<li>".$row["Field1"].". ".$row["Field2"]); 

// display EITHER option A or B depending on whether FieldA or B is not null 
if (isset($row['LinkA']))
{
echo("<br>Option A: ".$row["FieldA"]." "); 
echo("<a href=\"".$row["LinkA"]."\" target=\"_blank\">Link</a></li>"); 
}
else
{
echo("<br>Option B: ".$row["FieldB"]." "); 
echo("<a href=\"".$row["LinkB"]."\" target=\"_blank\">Link</a></li>"); 
}
}
 
Back
Top