[PHP] PHP Array question
I have an array with image names like: $arrayone = array(1.jpg, 2.jpg); $arraytwo = array(a.jpg, b.jpg); Then I have a variable for each to count the number of elements: $arrayoneElements = count($arrayone); $arraytwoElements = count($arraytwo); I'm using the element variables to control the loop to display all the array elements. This is it: for($ctr=1; $ctr $elemcount; $ctr++){ if($ctr%5){ echo td width=\20%\a href=\javascript:popup_pic('.$gallerypath./$arr[$ctr]')\img src=\.$gallerypath.thumbs/$arr[$ctr]\ alt=\no image\ //a/td; }else{ echo td width=\20%\a href=\javascript:popup_pic('.$gallerypath./$arr[$ctr]')\img src=\.$gallerypath.thumbs/$arr[$ctr]\ alt=\no image\ //a/td/tr\ntr; } } What I want to do is to only show 20 pictures at a time with a Next link and a Previous link. For the first 20 only the Next link would show and whenever the last set would show only the Previous link would. Every other time both would show. Can someone point me in the right direction on how to count through the elements until the end and back to display them? I just can't figure it out. Thanks, -Roy
Re: [PHP] PHP Array question
What I want to do is to only show 20 pictures at a time with a Next link and a Previous link. For the first 20 only the Next link would show and whenever the last set would show only the Previous link would. Every other time both would show. Can someone point me in the right direction on how to count through the elements until the end and back to display them? I just can't figure it out. sounds like you just might need some paging functions http://pear.php.net/package/Pager http://pear.php.net/manual/en/package.html.pager.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php array question
Hi, I have a line of php that I don't really understand. foreach($this-orders as $OrderID = $value) { echo $OrderID.BR; $OrderObject =$this-orders[$OrderID=$value]; echo $OrderObject-OrderID.--all the sameBR; } I know that $this-orders is an array of order objects. the result i get from this is: line1. 388--OrderID. line2. 389--all the same line3. 389--OrderID. line4. 389--all the same I'm really confused about why line 1 and line 3 have different OrderID, but line 2 and 4 have the same... I've been trying to fix this bug for 3 hrs with no luck. Any help would be really appreciated.. Thanks a lot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php array question
-Original Message- From: Victor C. [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 02, 2004 3:06 AM To: [EMAIL PROTECTED] Subject: [PHP] php array question Hi, I have a line of php that I don't really understand. foreach($this-orders as $OrderID = $value) { echo $OrderID.BR; I think Problem is with this line (I am surprised to see it does not throw a parsing error. As it should !) $OrderObject =$this-orders[$OrderID=$value]; If $this-orders is an array of order objects then Following line should be sufficient $OrderObject =$this-orders[$OrderID]; Or $OrderObject =$value; Zareef ahmed echo $OrderObject-OrderID.--all the sameBR; } I know that $this-orders is an array of order objects. the result i get from this is: line1. 388--OrderID. line2. 389--all the same line3. 389--OrderID. line4. 389--all the same I'm really confused about why line 1 and line 3 have different OrderID, but line 2 and 4 have the same... I've been trying to fix this bug for 3 hrs with no luck. Any help would be really appreciated.. Thanks a lot -- Zareef Ahmed :: A PHP develoepr in Delhi ( India ) Homepage :: http://www.zasaifi.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php