formatting based on mysql_num_rows
Posted: Fri Nov 21, 2008 8:56 am
I am trying to create a list of urls. I want the first list item to have a space with a larger height than the following items. So height for the first table row would be 3 and the following table rows would be 1. $line is the variable I'm using to define the height. Here is the code I'm currently using:
The result I'm getting is that each list item has a height of 3. Any suggestions on how to correct this would be appreciated.
Thank you.
B
Code: Select all
$num_rows = mysql_num_rows($result);
if($num_rows = 1)
$line = 3;
else
$line = 1;
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo '<tr height="' . $line . '">' .
'<td bgcolor="#AEBFAE"><img name="spacer" src="../images/clear.gif" border="0" alt="" height="1" width="175"><BR>' .
'</td>' .
'</tr>' .
'<tr>' .
'<td bgcolor="#F0EDE3" class="sub"><a href=\"' . $row['url'] . '\">' . $row['name'] . '</a>' .
'</td>' .
'</tr>';
}Thank you.
B