Re: pagination php mysql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I am implementing pagination on my php script, pagination is already 
> working, the result is displayed as checkboxes for users to check their
> choices. my prob is if i have more than 1 page, users should be able to
> choose from all 4 pages,

one solution is creating a temporal table, which can be re-created and
dropped when starting and ending the user session (table name can be
an unique_ID). Then, the checkbox selections are inserted, deleted,
etc.. with mysql_functions every time the user change every page.

Another solution is adding the ID of every selected checkbox to a
cookie or session variable in format 1,5,42,87,412... etc.  Then you
can manage the selections changes by reading the array elements using
a for... when the user change every page:

$foo = array_unique($foo); // checkbox selections
if (count($foo) > 0) {
   // loop through the array of selections
   for ($i=0;$i<count($foo);$i++) { 

      // read and write the session_var to update, delete, etc..
      if (eregi($foo[$i], $session_var)) {  // if exists ...etc

      }
      //...

   }
} 

When the user ends, you will have a temporal table or a session
variable with all his checkboxes selected. 

First method is slower but more secure. Second is speediest but it can
have more failures because are session vars or cookies.  It depends of
your control errors and also the visits profile.


Hope it helps,


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux