Help With Inventory Listings
am 21.01.2007 02:45:53 von Brandon BeardenCan 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 3 ACT QTY
BCK HLD INC OG USR OUT DATE OUT USR IN DATE IN USR
CY
20860003 Movie name action 1 1 0
10000000 0000-00-00 00:00:00 0000-00-00 00:00:00 0
20860020 Move 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 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 3 ACT QTY
BCK HLD INC OG USR OUT DATE OUT USR IN DATE IN USR
CY
GENRE: ACTION - 1 TITLES
20860003 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
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.
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 |
$dvdId | ");$dvdTitle | ");width=\"75\">$dvdGenre"); | $dvdGenre2 | ");width=\"75\">$dvdGenre3"); | $active | ");width=\"10\">$dvdOnHand"); | $back | ");$hold | ");$incoming | ");width=\"50\">$ogUserId"); | $outDate | ");width=\"55\">$outUserId"); | $inDate | ");width=\"50\">$inUserId"); | $cycles | ");
82. }
HERE IS THE MYSQL TABLE:
CREATE TABLE sp_dvd(
dvdId int(8) UNSIGNED AUTO_INCREMENT NOT NULL UNIQUE PRIMARY KEY,
dvdActive smallint(1) NOT NULL,
backordered smallint(1) NOT NULL,
dvdHoldRequests int(4),
incomingInventory int(3),
dvdTitle varchar(50) NOT NULL UNIQUE,
dvdDescription text(500),
dvdActors varchar(200),
dvdGenre varchar(35),
dvdGenre2 varchar(35),
dvdGenre3 varchar(35),
dvdYear int(4),
dvdLength int(4),
dvdCover varchar(100),
dvdCover2 varchar(100),
dvdOnHand int(3),
firstInventoryDate TIMESTAMP,
ogUserId int(8),
outDate TIMESTAMP,
outUserId int(8),
inDate TIMESTAMP,
inUserId int(8),
cycles int(4),
dvdLastUpdate TIMESTAMP,
dvdLastAdminUpdate int(8),
rand varchar(150),
exchangeId int(8),
FULLTEXT (dvdTitle,dvdActors)
)TYPE=MyISAM AUTO_INCREMENT=20860000;
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php