Jump to content

alternating row colors


wmguk

Recommended Posts

Hi guys,

 

I have a script which displays results in rows in a table, however I need to make the rows alternate 2 colours...

 

<? if($no_menu!=0){ ?>
	<tr>
          <td width="75" align="center" class="main">Delete</td>
	  <td align="left" class="main">Property Title</td>
	  <td width="100" align="center" class="main">Property of<br />the Week</td>
          <td width="80" align="center" class="main">Available</td>
          <td width="70" align="center" class="main">Display</td>
	</tr>
	<? while($row_menu=mysql_fetch_array($result_menu)){  ?>
        <tr>
        <td align="center"><a href="editproperty.php?mode=del&pid=<?=base64_encode("$row_menu[pid]")?>" class="link" onClick="return confirm('Are you sure want to delete this data!');" title="Click to Delete">Delete</a></td>
        <td align="left" class="main"><a href="addproperty.php?pid=<?=base64_encode("$row_menu[pid]")?>" class="link" title="Click to Edit"><strong>
	<? 
	if ($row_menu['type'] == "C") { 
	echo "Commercial";
	} else { 
	echo "Residential"; 
	}?> | <? 
	if ($row_menu['style'] == "A") { 
	echo "Auction"; 
	} elseif ($row_menu['style'] == "L") { 
	echo "Lettings"; 
	} else { 
	echo "Sale"; 
	}?> | <?= stripslashes($row_menu['owner_name'])?>
	</strong></a></td>
	<td align="center" class="normaltext1">
	  <? if($row_menu['feature']=='y'){?>
        <a href="editproperty.php?mode=feature&pid=<?=base64_encode($row_menu['pid'])?>&flag=n" class="link" onClick="return confirm('Are you sure want to change status?');" title="Click to change Status">Yes</a>
		<? } else {?>
	    <a href="editproperty.php?mode=feature&pid=<?=base64_encode($row_menu['pid'])?>&flag=y" class="link" onClick="return confirm('Are you sure want to change status?');" title="Click to change Status">No</a>
		<? }?>    </td>
    <td align="center" class="normaltext1">
	  <? if($row_menu['let']=='y'){?>
        <a href="editproperty.php?mode=let&pid=<?=base64_encode($row_menu['pid'])?>&flag=n" class="link" onClick="return confirm('Are you sure want to change status?');" title="Click to change Status">Yes</a>
		<? } else {?>
	    <a href="editproperty.php?mode=let&pid=<?=base64_encode($row_menu['pid'])?>&flag=y" class="link" onClick="return confirm('Are you sure want to change status?');" title="Click to change Status">No</a>
		<? }?>    </td>
    <td align="center" class="normaltext1">
	  <? if($row_menu['flag']=='y'){?>
        <a href="editproperty.php?mode=display&pid=<?=base64_encode($row_menu['pid'])?>&flag=n" class="link" onClick="return confirm('Are you sure want to change status?');" title="Click to change Status">Yes</a>
		<? } else {?>
	    <a href="editproperty.php?mode=display&pid=<?=base64_encode($row_menu['pid'])?>&flag=y" class="link" onClick="return confirm('Are you sure want to change status?');" title="Click to change Status">No</a>
		<? } ?>    </td>
	</tr>
	<? 
        }
	} else { ?>
	<tr>
	  <td colspan="4" align="center" class="main"><strong>No Properties are available.</strong></td>
	</tr>
	<? } ?>

 

I've tried to do this, but i cannot get it to alternate...

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/188201-alternating-row-colors/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.