Re: Help With Inventory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Brandon Bearden wrote:
What I WANT to see is something like this

DVD ID | TITLE | GENRE 1 | GENRE 2 | GENRE 3 | ACT | QTY BCK | HLD | INC | OG USR | OUT DATE | OUT USR | IN DATE | IN USR CY

GENRE: ACTION - 1 TITLES
20860023 | Movie name | ACTION | | | 1 | 1 | 0 | 10000000 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 | 0

GENRE: COMEDY - 2 TITLES
20860023 | Movie name | COMEDY | | | 1 | 1 | 0 | 10000000 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 | 0 20860006 | Movie name | COMEDY | | | 1 | 1 | 0 | 10000000 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 | 0




What I HAVE RIGHT NOW IS:

DVD ID | TITLE | GENRE 1 | GENRE 2 | GENRE 3 | ACT | QTY BCK | HLD | INC | OG USR | OUT DATE | OUT USR | IN DATE | IN USR CY

20860023 | Movie name | ACTION | | | 1 | 1 | 0 | 10000000 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 | 0 20860023 | Movie name | COMEDY | | | 1 | 1 | 0 | 10000000 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 | 0 20860006 | Movie name | COMEDY | | | 1 | 1 | 0 | 10000000 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 | 0


Thanks for you help :) I appreciate it very much.


"Roman Neuhauser" <neuhauser@xxxxxxxxxx> wrote in message news:20070123081704.GA1063@xxxxxxxxxxxxxxxxxxx
# brandon@xxxxxxxxxx / 2007-01-22 22:55:50 -0800:
"Jim Lucas" <lists@xxxxxxxxx> wrote in message
news:45B4E882.5050905@xxxxxxxxxxxx
$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


This should give you an idea of what you should have for displaying the header/genre/section name

$oldGenre = '';
while( $row = fetch_row() ) {
    if ( $oldGenre != $row['genre'] ) {
        echo '<tr><th align="left" colspan="16">'.
                 $row['genre'].'</td></tr>';
        $oldGenre = $row['genre'];
    }
    // format the following with your table
    print_r($row);
}


Also, be warned, I noticed that I missed something in my first reply to you. I have the closing table tag inside the while loop. So you need to move that outside the while loop.

Jim

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux