simplish if else statement

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

johnworf
Forum Commoner
Posts: 28
Joined: Fri Nov 02, 2007 1:02 pm

Re: simplish if else statement

Post 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>';
}
?>
 
mattpointblank
Forum Contributor
Posts: 304
Joined: Tue Dec 23, 2008 6:29 am

Re: simplish if else statement

Post by mattpointblank »

For the millionth time, you don't need the 'do' statements. What are you trying to do with that while() part?
johnworf
Forum Commoner
Posts: 28
Joined: Fri Nov 02, 2007 1:02 pm

Re: simplish if else statement

Post 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?
Post Reply