Page 2 of 2

Re: simplish if else statement

Posted: Thu Feb 19, 2009 8:08 am
by johnworf

Code: Select all

 
<?php 
 
if ( $totalRows_Recordset1 > 0 ) 
{
echo '<table width="580" border="0" cellspacing="0" cellpadding="0"><tr><td><h2>Restaurant</h2></td>  <td><h2>Description</h2></td><td><h2>Report</h2></td></tr></table>';
    
do
echo '<tr style="background-color:$color">';
echo '<td><a href="http://' .$row_Recordset1['Website']. '" target="_blank" rel="nofollow"><' .$row_Recordset1['Restaurant']. '</a></td>"<td>' .<$row_Recordset1['Description'].'</td>"';
echo '<td><a href="mailto:reportabuse@foobar.com?subject=' .$row_Recordset1['URL']. '">Report Abuse</a></td></tr>';
 
while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
 
echo '<p>Do you want to <a href="../advertise-your-restaurant.php">advertise your restaurant</a> in the town of Alabaster?</p>';
}
else 
{   
echo '<p>Do you want to <a href="../advertise-your-restaurant.php">advertise your restaurant</a> in the town of Alabaster?</p>';
}
?>
 

Re: simplish if else statement

Posted: Thu Feb 19, 2009 8:13 am
by mattpointblank
For the millionth time, you don't need the 'do' statements. What are you trying to do with that while() part?

Re: simplish if else statement

Posted: Thu Feb 19, 2009 7:25 pm
by johnworf
it's to go through the record to see if one exists - print out a row of the table if one does and keep doing it and also get alternating row colours - that's the whole point....

is there another way of doing this?