[PHP] Algorithm: Limiting Large Numbers of Pages to 10 visible
Hi, I need an algorithm for paging. If I have 100 pages of results, I only want to show Prev 1 2 3 4 5 6 7 8 9 10 Next Where I limit the number to 10 results of pages, but I cannot figure it out for the life of me. for ($i = $page; $i = ($page+10); $i++) { if ($i != $page) { echo a href=\$PHP_SELF?catid=$catidpage=$i\$i/a ; } else { echo $i ; } } echo a href=\$PHP_SELF?catid=$catidpage=$i\/a ; echo a href=\$PHP_SELF?catid=$catidpage=$num_pages\End/a ; } But what I need to do is not show pages that aren't there, and I'm hardwiring it to show 10 whether they exist or not. I've got to believe that there's a really slick way of doing this. I've searched the usual places (weberdev.com, devshed.com, zend.com) but there's no really good keywords, and when you search on 'paging you get too many results to be useful Thanks in advance, Lara - Lara J. Fabans Lodestone Software, Inc [EMAIL PROTECTED] -- 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] HTTP_POST_VARS: Data there, but can't get to it
My bad for typing it in from memory. I'd retyped it in a few times, so I thought i had it perfect. Here's the exact code: print_r ($HTTP_POSTVARS); // yeilds the array that I pasted down below if ($flag==process) { $whatdo = $HTTP_POSTVARS['whatdo']; print_r($what_do); // blank . . . for ($x=0;$x=$row;$x++) { $whatdox = $whatdo[$x]; print $whatdox; // blank . . . //loop start tr td nowrap p input type=radio name=whatdo[?php print $row?] value=load checked Loadbr input type=radio name=whatdo[?php print $row?] value=delete Deletebr input type=radio name=whatdo[?php print $row?] value=change Change Category/p /td . . . - Lara J. Fabans Lodestone Software, Inc [EMAIL PROTECTED] At 09:41 AM 10/11/01, Lara J. Fabans wrote: Hi, I'm having some difficulties accessing HTTP_POST_VARS The original form has a table where each row has a set of 3 radio buttons name=whatdo?php print $x?[] where $x is the row counter. (I'm using PHP to pull info into a table, then the user manipulates the info, and it places the info into 2 other tables depending upon what the choice is for the 3 radio buttons). So, on submit, it reloads the page, and I pull in all of the areas. All work except the radio buttons. I've tried: $submitted_vars = $HTTP_POST_VARS; $whatdo = $submitted_vars[whatdo]; --- and $whatdo = $HTTP_POST_VARS[whatdo]; -- but when I do a print_r($whatdo) it's blank When I do a print_r($HTTP_POST_VARS) I get Array ( [whatdo] = Array ( [0] = load [1] = delete), [other stuff]) What am I doing wrong :-) How do I access this data? It's so frustrating since all the rest of the postvars are working, and I can see that the data's there in the HTTP_POST_VARSI just can't get to it. (pun not intended) Thanks, Lara - Lara J. Fabans Lodestone Software, Inc [EMAIL PROTECTED] -- 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] -- 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] -- 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] HTTP_POST_VARS: Data there, but can't get to it
Just an addendum, I changed it from radio buttons to a pop up menu p select name=whatdo[] id=whatdo option value=load selectedLoad/option option value=deleteDelete/option option value=changeChange Category/option /select /p Again, if I print_r (HTTP_POST_VARS), I can see the Array ( [whatdo] = Array ( [0] = load [1] = delete), [other stuff]) but I cannot access it. I'm doing the same exact syntax for the image name=image[] which works perfectly. I can find nothing on this in the documentation or any of the other wonderful books websites out there. Please, what am I doing wrong in trying to access the HTTP_POST_VARS? Thanks, Lara At 08:36 AM 11/10/2001 -0800, Lara J. Fabans wrote: My bad for typing it in from memory. I'd retyped it in a few times, so I thought i had it perfect. Here's the exact code: print_r ($HTTP_POSTVARS); // yeilds the array that I pasted down below if ($flag==process) { $whatdo = $HTTP_POSTVARS['whatdo']; print_r($what_do); // blank . . . for ($x=0;$x=$row;$x++) { $whatdox = $whatdo[$x]; print $whatdox; // blank . . . //loop start tr td nowrap p input type=radio name=whatdo[?php print $row?] value=load checked Loadbr input type=radio name=whatdo[?php print $row?] value=delete Deletebr input type=radio name=whatdo[?php print $row?] value=change Change Category/p /td . . . - Lara J. Fabans Lodestone Software, Inc [EMAIL PROTECTED] At 09:41 AM 10/11/01, Lara J. Fabans wrote: Hi, I'm having some difficulties accessing HTTP_POST_VARS The original form has a table where each row has a set of 3 radio buttons name=whatdo?php print $x?[] where $x is the row counter. (I'm using PHP to pull info into a table, then the user manipulates the info, and it places the info into 2 other tables depending upon what the choice is for the 3 radio buttons). So, on submit, it reloads the page, and I pull in all of the areas. All work except the radio buttons. I've tried: $submitted_vars = $HTTP_POST_VARS; $whatdo = $submitted_vars[whatdo]; --- and $whatdo = $HTTP_POST_VARS[whatdo]; -- but when I do a print_r($whatdo) it's blank When I do a print_r($HTTP_POST_VARS) I get Array ( [whatdo] = Array ( [0] = load [1] = delete), [other stuff]) What am I doing wrong :-) How do I access this data? It's so frustrating since all the rest of the postvars are working, and I can see that the data's there in the HTTP_POST_VARSI just can't get to it. (pun not intended) - Lara J. Fabans Lodestone Software, Inc [EMAIL PROTECTED] -- 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]
[PHP] HTTP_POST_VARS: Data there, but can't get to it
Hi, I'm having some difficulties accessing HTTP_POST_VARS The original form has a table where each row has a set of 3 radio buttons name=whatdo?php print $x?[] where $x is the row counter. (I'm using PHP to pull info into a table, then the user manipulates the info, and it places the info into 2 other tables depending upon what the choice is for the 3 radio buttons). So, on submit, it reloads the page, and I pull in all of the areas. All work except the radio buttons. I've tried: $submitted_vars = $HTTP_POST_VARS; $whatdo = $submitted_vars[whatdo]; --- and $whatdo = $HTTP_POST_VARS[whatdo]; -- but when I do a print_r($whatdo) it's blank When I do a print_r($HTTP_POST_VARS) I get Array ( [whatdo] = Array ( [0] = load [1] = delete), [other stuff]) What am I doing wrong :-) How do I access this data? It's so frustrating since all the rest of the postvars are working, and I can see that the data's there in the HTTP_POST_VARSI just can't get to it. (pun not intended) Thanks, Lara - Lara J. Fabans Lodestone Software, Inc [EMAIL PROTECTED] -- 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] Re: COM
At 05:40 PM 8/22/2001 -0500, Richard Lynch wrote: I heard refs on using the COM interface to access MS Word files. Is this a procedure an interface that only works on Windows systems (as that is where Word runs)? Yes... Almost for sure... There *MIGHT* be some hack port of COM objects to Un*x, but you'd be better off using a doc2xxx utility to convert Word to something usable instead. You're supposed to technically be able to save COM objects out to a CORBA idl; however, that may be far more work then the original poster wanted to do. MS did join the OMG, and there are supposedly some tools out there, but nothing as easy to use as java2idl. - Lara J. Fabans Lodestone Software, Inc [EMAIL PROTECTED] -- 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] Having trouble with PHP exec function calling CGI program
Hi, Tony, I'm a middlebie, and I have the same problem. From the archives, I found the following suggestions from Richard Lynch: Does it work perfectly from the command line if you su to nobody (or whomever PHP runs as) before you execute it? Is it world executable? Does it access resources such as PGP key-rings that nobody can/cannot access? Are you sure you have the path correct? In my case, the answer is yes to all of the above (except for su'ing to nobody since I can't do that on this client's server). I've also discovered that it's usually a path/permission problem unless the server was built in 'safe mode' in which case, no script can be called. I added in `date`; to see if I could execute anything nothing happened, so I fear this. Now all I need to do is read up on suid in the PHP manual.Thankfully, this is just a tool for the client, and not something the world will see. Any other suggestions? Lara - Original Message - From: Tony Frasketi [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, August 13, 2001 6:08 AM Subject: [PHP] Having trouble with PHP exec function calling CGI program Hello list members I'm a newbie and having trouble with the EXEC function call from a PHP script. I've submitted this problem to the list last week but so far no response. And I still haven't figured it out. So here goes again. PHP EXEC function seems to work ok for executing shell commands like 'ls -al' etc. but when I execute the following PHP web page code... -- $basedir = '/mnt/web/xxx/myplace'; $cdir = $basedir . '/cgibin'; $cmd = cd $cdir;pwd;perl -w myscript.cgi; echo cmd: $cmdbr; $result = exec($cmd,$arr,$status); echo status: $status [$result]br; -- The cgi program has been chmod'ed to 755 so it can run from a webpage and the cgi program runs fine when _not_ called from the PHP script. I get a status code of 155. Can someone please explain what this error code means! Thanks in advance Tony Frasketi -- 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] -- 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]
[PHP] Can't run perl script using exec or system
Hi, friends, Using the following code, the two files copyUp.pl and convert.pl aren't called. I can run them peachy dandy from the commandline with the expected results. I've tried system(), exec(), and back tics. Thanks, Lara ---8 8 - $command = /home/copyUp.pl $sellerid $image; exec($command, $output, $error); if($error) { echo OS Error1 $errorbr; } $filename = basename($image); print Filename: $filename; $cmd=/home/convert.pl $sellerid $filename; exec($cmd, $output, $error); if($error) { echo OS Error2 $errorbr; } - Lara J. Fabans Lodestone Software, Inc [EMAIL PROTECTED] -- 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] PHP scripting
to do what? There's tons of sample scripts out there on www.weberdev.com www.zend.com www.devshed.com if you just want to go absorb knowledge Lara - Original Message - From: Kyle Smith [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 25, 2001 9:40 PM Subject: [PHP] PHP scripting Could some of you people please send me some scripts you have made (not too complicated) as i find it easier to learn from hands on experience =) Thanks -legokiller666- http://www.StupeedStudios.f2s.com New address new site ICQ: 115852509 MSN: [EMAIL PROTECTED] AIM: legokiller666 -- 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]
[PHP] How to unsubscribe
I hope you all enjoy this as much as I did. Lara Subject: How to unsubscribe from the list. :) You see, all of those to unsubscribe, do this. instructions at the bottom of the emails sent through this list are wrong. We only put those there to confuse everyone so that they will never leave the list. Since you've obviously got more intelligence than to follow instructions from the list owner ... here are the *REAL* instructions on how to unsubscribe: 1) Go to A HREF=http://www.dictionary.com/;www.dictionary.com/A and look up the word unsubscribe. 2) There is a hidden link right above the third word in the definition.click it. 3) That link will take you to Langley (US Security System). 4) Enter the launch code 345897349 to send a missile to 42 degrees north latitude, 98 degrees east longitude. 5) Right before the missile lands, there will be a flash on your screen with directions on how to build a model airplane. 6) Print those instructions and build the plane. 7) Take the plane to the roof of your building and fly it. 8) It will land on the sidewalk on a loose slab of concrete. Pick up the concrete and put it in the nearest trash can. 9) Dig in the dirt under the concrete and there will be a red button. If you push the button, you will unsubscribe yourself from this list. - Lara J. Fabans Lodestone Software, Inc [EMAIL PROTECTED]
[PHP] ereg parse error problem
Hi, friends, I'm receiving a parse error on the if (ereg... ) lines of this code. I looked at the online manual and modeled my two ereg's after it. When I kept getting parse errors, I decided to copy the original from the manual into my code, and it too received a parse error. Can someone please help me resolve this? Thank you, Lara - ?php $string = lt;a href=quot;http://www.qksrv.net/click-297915-361662quot; target=quot;_topquot; gt; lt;img src=quot;http://www.123posters.com/images/m-mase01.jpgquot; alt=quot;Mase Necklacequot;gt;lt;/agt; lt;img src=quot;http://www.qksrv.net/image-297915-361662quot; height=quot;1quot; width=quot;1quot; border=quot;0quot;gt; if (ereg (([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}), $string, $regs)) { echo $regs[3].$regs[2].$regs[1]; } else { echo Invalid date format: $date; } if (ereg (img src=quot;(.*)quot;, $string, $regs)) { echo $regs[1]; } else { echo nope1; } if (eregi(a href=quot;(.*)quot;, $string, $regs)) { echo $regs[1]; } else { echo nope2; } ? - Lara J. Fabans Lodestone Software, Inc [EMAIL PROTECTED] -- 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]
[PHP] Was: ereg parse error problem Now: RegEx Plea for Help
Thank you, Phil, for fixing that. Obviously this snippet is trying to be a smaller test case for a much larger problem. It looks like I'm pulling *all* of the img and a href from the $string and I don't want that at all. I just want one of them. So, my return is: image source:http://www.123posters.com/images/m-mase01.jpg; alt=Mase Necklace/a img src=http://www.qksrv.net/image-297915-361662; height=1 width=1 border=0 href: http://www.qksrv.net/click-297915-361662; target=_top img src=http://www.123posters.com/images/m-mase01.jpg; alt=Mase Necklace/a img src=http://www.qksrv.net/image-297915-361662; height=1 width=1 border=0 I mistakenly though it would stop at the second quot;, but it's going all the way to the end. Is there any way to tell it to find one instance instead of the globalizing like it's doing? I'm going to play around with a few more things, but after staring at the code for 4 hours, my brain is fried. Thanks, Lara At 06:59 PM 7/12/2001 -0700, Lara J. Fabans wrote: - ?php $string = lt;a href=quot;http://www.qksrv.net/click-297915-361662quot; target=quot;_topquot; gt; lt;img src=quot;http://www.123posters.com/images/m-mase01.jpgquot; alt=quot;Mase Necklacequot;gt;lt;/agt; lt;img src=quot;http://www.qksrv.net/image-297915-361662quot; height=quot;1quot; width=quot;1quot; border=quot;0quot;gt;; if (ereg (img src=quot;(.*)quot;, $string, $regs)) { echo image source:$regs[1]br; } else { echo nope1; } if (eregi(a href=quot;(.*)quot;, $string, $regs)) { echo href: $regs[1]br; } else { echo nope2; } ? - Lara J. Fabans Lodestone Software, Inc [EMAIL PROTECTED] -- 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]