Jump to content

PHP Alternate row help please


ozone1

Recommended Posts

Hi guys i need a little help to list data in different coloured rows

 

i need to list 1st name in <td class="alt1"> 2nd name in <td class="alt2"> and so on

currently it is listing only in <td class="alt1">

 

here is my code any help really appreciated

 

<?php

 

$result[0] = mysql_query("SELECT * FROM videos ORDER BY viewtoday

DESC LIMIT 10");

 

for($i=0;$i<count($result);$i++) {

echo '';

while($row=mysql_fetch_array($result[$i])) {

$id = $row['id'];

$cat = $row['cat'];

$title = $row['title'];

$numviews = $row['viewtoday'];

 

$max_length = 25;

$title = ( strlen($title) > $max_length ?

substr($title,0,$max_length)."..." : $title );

 

 

echo '<table class="listOfShows listOfShowsFirst"><tr>

<td class="alt1">

<a href="videos.php?id=' . $id . '">'. $title . '</a> </td>

</tr>';

 

}

 

}

 

?>

</table></td></table>/php]

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.