[PHP] Help With Inventory

2007-01-20 Thread Brandon Bearden
Can anyone help me figure out how to solve my inventory listing problem?

I am using php_5 and mysql_5.0 w/apache on fbsd.

I need to figure out a way to make a subtitle for every category (genre)
in the inventory so when I list the entire inventory on a sheet (at
client's request), it is organized by category (genre) and each category
(genre) has a title line above it. So the there is not just one big list
rather a neat list with titles for each category THEN all the rows in that
category etc. I can't figure out the loop to make the titles.

I have them sorted as you can by genre, the list is formatted fine There
are alternating colors on the rows to make it read easier. I just want to
keep from having to make a statement for EACH genre. I will eventually
make the genre list dynamic too, so I need to figure out how to
dynamically generate this inventory list.

This is the output I have now:

DVD ID  TITLE GENRE 1  GENRE 2   GENRE 3ACT QTY
BCK   HLDINC OG USR   OUT DATE   OUT USRIN DATE IN USR
  CY
20860003Movie name action 1  1 0
 1000-00-00 00:00:00  -00-00 00:00:000
20860020Move Name   COMEDY   11   0
  1000  -00-00 00:00:00  -00-00 00:00:00
 0
20860006Movie name COMEDY 1  1 0
 1000-00-00 00:00:00  -00-00 00:00:000


What I WANT to see is:
I will fix the background colors, I just want to see the "GENRE: ACTION -
1 TITLES and GENRE: COMEDY - 2 TITLES"

DVD ID  TITLE GENRE 1  GENRE 2   GENRE 3ACT QTY
BCK   HLDINC OG USR   OUT DATE   OUT USRIN DATE IN USR
  CY

GENRE: ACTION - 1 TITLES
20860003Movie name ACTION 1  1 0
 1000-00-00 00:00:00  -00-00 00:00:000

GENRE: COMEDY - 2 TITLES
20860023Movie name  COMEDY1   1
  0   1000 -00-00 00:00:00-00-00 00:00:00
0
20860006Movie name COMEDY 1  1 0
 1000-00-00 00:00:00  -00-00 00:00:000







This is the code:
1.  function invlistONE(){
2.  dbconnect('connect');
3.  $invlist = mysql_query("SELECT * FROM sp_dvd ORDER BY dvdGenre");
4.
5.
6.  ?>
7.  
10. DVD ID
11. TITLE
12. GENRE 1
13. GENRE 2
14. GENRE 3
15. ACT
16. QTY
17. BCK
18. HLD
19. INC
20. OG USR
21. OUT DATE
22. OUT USR
23. IN DATE
24. IN USR
25. CY
26. 
27. 
28. "); }
56. else { echo ("");}
57.
58. echo ("");
59. echo (" $dvdId ");
60. echo ("$dvdTitle");
61. echo ("$dvdGenre");
62. echo ("$dvdGenre2");
63. echo ("$dvdGenre3");
64. echo ("$active");
65. echo ("$dvdOnHand");
66. echo ("$back");
67. echo ("$hold");
68. echo ("$incoming");
69. echo ("$ogUserId");
70. echo ("$outDate");
71. echo ("$outUserId");
72. echo ("$inDate");
73. echo ("$inUserId");
74. echo ("$cycles");
75. echo ("");
76. echo ("");
77.
78. $count++;
79. if ( $count == 2 ) { $count = 0; }
80. }
81. ?>http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Help With Inventory

2007-01-22 Thread Brandon Bearden
Thank you for your help. I see what you are doing different. 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.

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 
s cool.

"Jim Lucas" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Here is my rendition of your script.  Give it a shot...
>
> Let me know if you have any question about what is going on.
>
> I was curious, what is the point of having the alternating column colors? 
> Was that your intention?
>
> 
> function invlistONE(){
> dbconnect('connect');
> $invlist = mysql_query("SELECT * FROM sp_dvd
> ORDER BY dvdGenre");
>
>
> echo <<
> 
> .dvdDisplay th {
> font-size: 9pt;
> text-align: left;
> }
> .dvdDisplay td {
> font-size: 8pt;
> }
> 
>
>  } else {
> $rowColor = '';
> }
>
> echo <<
> 
> {$row['dvdId']
> {$row['dvdTitle']}
> {$row['dvdGenre']}
> {$row['dvdGenre2']}
> {$row['dvdGenre3']}
> {$row['dvdActive']}
> {$row['dvdOnHand']}
> {$row['backordered']}
> {$row['dvdHoldRequests']}
> {$row['incomingInverntory']}
> {$row['ogUserId']}
> {$row['outDate']}
> {$row['outUserId']}
> {$row['inDate']}
> {$row['inUserId']}
> {$row['cycles']}
> 
>
> HEREDOC;
>
> $count++;
>
> echo '';
> }
> }
>
> ?> 

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



Re: [PHP] Help With Inventory

2007-01-22 Thread Brandon Bearden
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  |   1000  | 
-00-00 00:00:00 | -00-00 00:00:00 |0

GENRE: COMEDY - 2 TITLES
20860023  |  Movie name  |  COMEDY  | | |  1  |   1  |   0  |   1000  | 
-00-00 00:00:00 | -00-00 00:00:00 |0
20860006  |  Movie name  |  COMEDY  | | |  1  |   1  |   0  |   1000  | 
-00-00 00:00:00 | -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  |   1000  | 
-00-00 00:00:00 | -00-00 00:00:00 |0
20860023  |  Movie name  |  COMEDY  | | |  1  |   1  |   0  |   1000  | 
-00-00 00:00:00 | -00-00 00:00:00 |0
20860006  |  Movie name  |  COMEDY  | | |  1  |   1  |   0  |   1000  | 
-00-00 00:00:00 | -00-00 00:00:00 |0


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


"Roman Neuhauser" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
># [EMAIL PROTECTED] / 2007-01-22 22:55:50 -0800:
>> "Jim Lucas" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>> > $count = 0;
>> > while ( $row = mysql_fetch_array( $invlist ) ) {
>> >
>> > if ( $count % 1 ) {
>> > $rowColor = '#c1c1c1';
>> > } else {
>> > $rowColor = '';
>> > }
>> >
>> > echo <<> >
>> > 
>> > {$row['dvdId']
>> > {$row['dvdTitle']}
>> > {$row['dvdGenre']}
>> > {$row['dvdGenre2']}
>> > {$row['dvdGenre3']}
>> > {$row['dvdActive']}
>> > {$row['dvdOnHand']}
>> > {$row['backordered']}
>> > {$row['dvdHoldRequests']}
>> > {$row['incomingInverntory']}
>> > {$row['ogUserId']}
>> > {$row['outDate']}
>> > {$row['outUserId']}
>> > {$row['inDate']}
>> > {$row['inUserId']}
>> > {$row['cycles']}
>> > 
>> >
>> > HEREDOC;
>> >
>> > $count++;
>> >
>> > echo '';
>> > }
>> > }
>> >
>
>> 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
>> s 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 

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