RE: [PHP] Nested Loops
On 18 February 2004 22:13, Alex Hogan wrote: Sorry..., Line 17 is: print trtda href=\$id\$row2[$rtxt]/a/td/tr; I haven't a clue what this is relating to (bit *too* much snippage there!), but I think that statement is going to need some curly braces to have a chance of working as intended: print trtda href=\$id\{$row2[$rtxt]}/a/td/tr; Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Nested Loops
Thanks for the help guys..., After some sleep and some food this is where it's gone; $query = select wn_pdate, wn_text, wn_id . from whatsnew . order by wn_pdate; $pdate = ; while($row = mssql_fetch_array($result)){ if ($pdate != $row[0]) { print trtd . $row[0]/td/tr; $pdate = $row[0]; } print trtda href=\$id\ . $row[1] . /a/td/tr; } Results; Date 1 Item one Item two Item three Date 2 Item four Item five Item six ... etc It produces the results that I was looking for and it's much less code. alex hogan -Original Message- From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 4:50 AM To: 'Alex Hogan'; PHP General list Subject: RE: [PHP] Nested Loops On 18 February 2004 22:13, Alex Hogan wrote: Sorry..., Line 17 is: print trtda href=\$id\$row2[$rtxt]/a/td/tr; I haven't a clue what this is relating to (bit *too* much snippage there!), but I think that statement is going to need some curly braces to have a chance of working as intended: print trtda href=\$id\{$row2[$rtxt]}/a/td/tr; Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 ** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. **
RE: [PHP] Nested Loops
Alex Hogan mailto:[EMAIL PROTECTED] on Wednesday, February 18, 2004 2:06 PM said: Do I have something wrong with my syntax? Is there an easier way to do this? i don't know the answer to either of those questions but if it's complaining of an undefined index you might want to try print_r() and see what's actually stored within rs[] each pass through the loop. even better would be to look up the mssql functions and see if there is one that can turn your entire result set into an array with both numerical and text indices. then you can print_r() the entire array and see what's going on. hth, chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Nested Loops
Using print_r($var) shows that the vars are returning the right values, and where they're supposed to. Right in between the error messages. Doh. alex ** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. **
Re: [PHP] nested loops and PHPLIB templates
Hello paula, Monday, April 09, 2001, 6:47:21 AM, you wrote: p I was sending desperate emails to this list related to nested loops and array comparision. p Well, just let you know that the problem seems to be that I'm using this with PHPLIB p templates and those can't handle nested loops. template.html: table !-- BEGIN row -- tr !-- BEGIN column -- td{val}/td !-- END column -- /tr !-- END row -- /table code: // place here some code for multi-row multi-column data array $tpl = new Template; $tpl-set_file('tp', 'template.html'); $tpl-set_block('tp', 'row', 'row_parsed'); $tpl-set_block('row', 'column', 'column_parsed'); foreach ($rows as $row = $columns) { /* IMPORTANT: free the column block from previous results, do it like this: */ $tpl-set_var('column_parsed', ''); foreach ($columns as $column) { $tpl-set_var('val', $column); $tpl-parse('column_parsed', 'column', true); } $tpl-parse('row_parsed', 'row', true); } $tpl-pparse('out', 'tp'); So, you have nested blocks filled with nested loops. -- Best regards, Maxim Derkachev mailto:[EMAIL PROTECTED] Symbol-Plus Publishing Ltd. phone: +7 (812) 324-53-53 http://www.Books.Ru -- All Books of Russia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] nested loops and PHPLIB templates
On Sun, Apr 08, 2001 at 10:47:21PM -0400, paula wrote: I was sending desperate emails to this list related to nested loops and array comparision. Well, just let you know that the problem seems to be that I'm using this with PHPLIB templates and those can't handle nested loops. Please subscribe to the PHPLib mailing list at php.net/support.php. If I would know that a week ago I would avoid nightmares and had 6 pounds more of weight. That depends on your size, I could need some more pounds :) -Egon -- LinuxTag, Stuttgart, Germany: July 5-8 2001: http://www.linuxtag.de/ All known books about PHP and related books: http://php.net/books.php Concert Band of the University of Hohenheim: http://www.concert-band.de/ First and second bestselling book in German: http://www.php-buch.de/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]