Hello Everyone, I'm building a hotel management system and I can't seem to figure out why my for() loop doesn't work the way it should. I'm using patTemplate to create the HTML Template (I like using it and I don't want to start a pro/con template war). Here is the script:
for ($j = 0; $j < 32; $j++) { for ($i = 0; $i < count($num_days); $i++) { $template->addVar("room_num", "ROOM_NUM", '101'); $template->addVar("room_type", "ROOM_TYPE", 'NQQ'); $template->addVar("guest_NameRate", "GUEST_NAME", 'NAVID YAR'); $template->addVar("guest_NameRate", "GUEST_ID", 'fname'); $template->addVar("guest_NameRate", "CLASS_GUEST", 'fname'); $template->addVar("guest_NameRate", "ROOM_RATE", '49.95'); $template->parseTemplate("guest_NameRate", "a"); } $template->parseTemplate("guest_row", "a"); } This inner for() loop works great. It creates a SINGLE row with 7 columns of data (one column for each day of the week). However, the outer for() loop does not work like it should. I want it to display 32 rows of 7 columns per row. But what happens is that on every row after the first row it appends 7 more columns at the end of each row. So row 2 will have 14 columns, row 3 will have 21 columns, row 4 will have 28 columns, and so on. I can't figure out why this is. Either it's something new in PHP5 or I'm doing something really stupid. I am sending a PDF attachment of a snapshot showing a hint, made purely with HTML, of what I am trying to achieve. If anyone can help me it would be greatly appreciated. Thanks guys.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php