What is the purpose of using the for loop?  if I may make a suggestion for
using the while loop.  The code would look something like this:

<?php
$color=1;
while ($lyric_array = mysql_fetch_array($lyrics)) {
    $comments = mysql_query("SELECT * FROM `comments` WHERE `resource_id` =
$lyric_array[0]");
    $num_comments = mysql_num_rows($comments);

    if ($color == 1) {
        $rowcolor = "#DFDFDF";
        $color ++;
    } else {
        $rowcolor = "#FFFFFF";
        $color --;
    }

    echo "<tr bgcolor=\"";
    echo "\"><td><a
href=\"view.php?id=$lyric_array[0]\">$lyric_array[1]</a></td>";
    echo "<td>$lyric_array[3]</td>";
    echo "<td>$num_comments</td>";
    echo "<td>$lyric_array[2]</td>";
    echo "<td><a href=\"$lyric_array[4]\">Buy at Amazon.com</td></tr>";

    $ltotalv = $ltotalv + $lyric_array[3];
}
?>

I was looking at the current code and wasn't seeing the purpose for the for
loop.  If I'm incorrect and you are using it for a specific purpose, please
let me know.

-aaron

"Tony Harrison" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> OK, the color works, but now I have 2 empty lines!!!!!!!!!!!!!!!!!!!!
>
> "Tony Harrison" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Thanx, I havent tried the loop yet, but the color will work im sure .
> >
> > "Aaron Ott" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > tony,
> > >
> > > regarding problem one, it looks like there is a problem in the code
> near:
> > > for ($g = 0; $g < $num_lyrics; $g ++) {
> > >
> > > try doing:
> > > for ($g = 0; $g <= $num_lyrics; $g ++) {
> > >
> > > As for problem two, it looks like you have your color variable set in
> the
> > > for loop thereby resetting the color variable to 1 with each pass:
> > > for ($g = 0; $g < $num_lyrics; $g ++) {
> > > $color = 1;
> > > if ($color == 1) { $rowcolor = "#DFDFDF"; $color ++; } else {
$rowcolor=
> > > "#FFFFFF"; $color --; }
> > > ...
> > > }
> > >
> > >
> > > "Tony Harrison" <[EMAIL PROTECTED]> wrote in message
> > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > OK, im having some minor problems with my site.
> > > > In artist.php (http://members.lycos.co.uk/ajohnh/artist.php - Source
> at:
> > > > http://members.lycos.co.uk/ajohnh/source/artist.txt) If for example
> you
> > > view
> > > > lyrics by Weird Al Yankovic
> > > > (http://members.lycos.co.uk/ajohnh/artist.php?id=1) You'll see that
> the
> > > > bottom lyric (The Sage Begins) does not display. Now when you sort
> them
> > by
> > > > views
(http://members.lycos.co.uk/ajohnh/artist.php?id=1&sortby=views)
> > you
> > > > will see that err, The Sage Begins is there, and the other one can
no
> > > longer
> > > > be seen. PLease examine my source and tell me whats wrong. And
another
> > > thing
> > > > about that page. The rows are meant to be alternating between
#DFDFDF
> > > (grey)
> > > > and #FFFFFF (white) - why the hell are they all grey?!?!?!!? It
worked
> > > fine
> > > > in index.php - source at
> > > http://members.lycos.co.uk/ajohnh/source/index.txt
> > > >
> > > >
> > > > Please help !!!!!!
> > > >
> > > >
> > >
> > >
> >
> >
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to