Re: Help With Inventory
| From: | Roman Neuhauser | Date: | Tue, 23 Jan 2007 08:17:04 +0000 |
| Subject: | Re: Help With Inventory | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-247609@lists.php.net to get a copy of this message | ||
# brandon@truzul.com / 2007-01-22 22:55:50 -0800:
> "Jim Lucas" <lists@cmsws.com> wrote in message
> news:45B4E882.5050905@cmsws.com...
> > $count = 0;
> > while ( $row = mysql_fetch_array( $invlist ) ) {
> >
> > if ( $count % 1 ) {
> > $rowColor = '#c1c1c1';
> > } else {
> > $rowColor = '';
> > }
> >
> > echo <<<HEREDOC
> >
> > <tr bgcolor="{$rowColor}">
> > <td class='body'>{$row['dvdId']</td>
> > <td>{$row['dvdTitle']}</td>
> > <td class='body'>{$row['dvdGenre']}</td>
> > <td>{$row['dvdGenre2']}</td>
> > <td class='body'>{$row['dvdGenre3']}</td>
> > <td>{$row['dvdActive']}</td>
> > <td class='body'>{$row['dvdOnHand']}</td>
> > <td>{$row['backordered']}</td>
> > <td class='body'>{$row['dvdHoldRequests']}</td>
> > <td>{$row['incomingInverntory']}</td>
> > <td class='body'>{$row['ogUserId']}</td>
> > <td>{$row['outDate']}</td>
> > <td class='body'>{$row['outUserId']}</td>
> > <td>{$row['inDate']}</td>
> > <td class='body'>{$row['inUserId']}</td>
> > <td>{$row['cycles']}</td>
> > </tr>
> >
> > HEREDOC;
> >
> > $count++;
> >
> > echo '</tbody></table>';
> > }
> > }
> >
> I don't understand how the quotient works there. I will sometime.
> I also don't understand the HEREDOC concept.
>
> I wanted colors alternating to allow for a better read.
Ignore the heredoc thing, the "quotient" (remainder after division)
works just like it worked in your math class, but it should be
if ( $count % 2 ) {
$rowColor = '#c1c1c1';
} else {
$rowColor = '';
}
Although I'd use
$rowColors = array('', '#c1c1c1');
...
$rowColor = $rowColors[$count % 2];
> I still have not solved the problem with listing the genre in its own row,
> alone at the beginning of each section of genre (the start of each unique
> genre which is the ORDER BY in the statement).
>
> Thanks for the code. I need to learn how to write more eloquently like you.
>
> If anyone can figure out the a row listing for the genres, that would be
> soooo cool.
You want something like this?
genre | #id | title | #id | title | #id | title
-------+-----+---------------+-----+---------------+-----+--------
horror | 123 | Scary Movie 1 | 456 | Scary Movie 2 | ... | ....
comedy | 234 | Funny Movie 1 | 456 | Funny Movie 2 | ... | ....
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991