pagination problem
The Pagination script works like a charm. However, this example has the following variables predefined :
tablename (records), $limit). I need this information to be obtained from a form in the previous page using post method. Here is my index.php: <?php $host = $_POST["subcat"]; $date = $_POST["txtDate"]; $tables = "table_".$host."_".$date; $database = $_POST["cat"]; $limit = $_POST["pagesize"]; if ($database=="pix") $device = "db_pix"; else $device = "db_swt"; //connect to mysql mysql_connect("127.0.0.1", "root", "") or die (mysql_error()); mysql_select_db($database) or die(mysql_error()); //get the function include_once ('function.php'); $page = (int) (!isset($_GET["page"]) ? 1 : $_GET["page"]); $startpoint = ($page * $limit) - $limit; //to make pagination $statement = "$tables ORDER BY datetime ASC"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Pagination</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link href="css/pagination.css" rel="stylesheet" type="text/css" /> <link href="css/grey.css" rel="stylesheet" type="text/css" /> <style type="text/css"> .records { width: 1300px; margin: 5px; padding:2px 5px; border:1px solid #B6B6B6; } .record { color: #474747; margin: 5px 0; padding: 3px 5px; background:#E6E6E6; border: 1px solid #B6B6B6; cursor: pointer; letter-spacing: 2px; } .record:hover { background:#D3D2D2; } .round { -moz-border-radius:8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius:8px; } p.createdBy{ padding:5px; width: 510px; font-size:15px; text-align:center; } p.createdBy a {color: #666666;text-decoration: none;} </style> </head> <body> <div class="records round"> <?php //show records $query = mysql_query("SELECT * FROM {$statement} LIMIT {$startpoint} , {$limit}"); while ($row = mysql_fetch_assoc($query)) { ?> <div class="record round"><?php echo "{$row['datetime']}==={$row['level']}==={$row['message']}";?></div> <?php } ?> </div> <?php echo pagination($statement,$limit,$page); ?> </body> </html> I am beginner is PHP and i am really confused how to do this.
4 Answers
Para Q Es El Medicamento Cephalexin <a href=http://cialiviag.com>canadian cialis</a> Priligy Ritardante Cytotec Voie Oral
Posted: Ellgaibra 0 of 0 people found this answer helpful. Did you? Yes No
generic cialis soft tabs 20mg
<a href="http://lzdwqokfs.com/">generic cialis soft tabs online</a> cialis 20mg tablets <a href="http://lzdwqokfs.com/">generic cialis release</a> cialis soft tabs 40mg http://lzdwqokfs.com/ generic viagra and cialis Posted: Thomascor 0 of 0 people found this answer helpful. Did you? Yes No
thank you. After a long research with my limited php knowledge. i found that i have to add the variables in pagination function call in index.php and add the same in function.php and use GET method.
I can post my edited php files if somebody needs an example. Posted: shbobj 0 of 0 people found this answer helpful. Did you? Yes No I know this is kind of old but if I could take a look ay those edited php files it would be great.
Thanks can i see the examples of your edited file. i am also having the same problem. thanks.
try to echo this in the second page echo
echo "SELECT * FROM {$statement} LIMIT {$startpoint} , {$limit};and tell me the result Posted: MacOS Edited: MacOS 0 of 0 people found this answer helpful. Did you? Yes No |
© Advanced Web Core. All rights reserved
please first make sure from the post data by var_dump it
October 13, 2011
I believe, i didnt explain the issue correctly. The first page works good but when i click the next button it shows a empty page. I added the var_dump and it shows me the values correctly in the first page. however, the next page does not work. it gives me a empty page. I am able to understand that the variable values are not getting passed to functions.php. But unfortunately, i dont know how to do it.
October 13, 2011