Claude Posted July 22, 2009 Share Posted July 22, 2009 Hi, I'm new and not so experienced in PHP, so sorry for any inconvenience. I'm stuck with following code. The resultlist must be divided into separate pages. the generated pagination link, doesn't work, it always displays the same part of the resultset. Can you help me please? Thx in advance. $paginator->total = count($mysql->mysql_array("SELECT * FROM productfiles")); $paginator->per = $module['config']['display']['results_per_page']; $order = order(array("orderby" => $_GET['orderby'],"order" => $_GET['order'])); $limit = limit(array("current_page" => $paginator->current_page,"per" => $paginator->per)); $query .= " SELECT * FROM productfiles"; $query .= " ".$order['query']; $query .= " ".$limit['query']; $databrowser->order = $order; $databrowser->data = $mysql->mysql_array($query); $databrowser->headers = array($module['data']['types']['pfile_date_created'],$module['data']['types']['pfile_description'],$module['data']['types']['pfile_file'],$module['data']['types']['pfile_size'],$module['data']['types']['pfile_type']); $toolbuilder->tool(array("label" => "Edit","href" => $PHP_SELF,"params" => array("action" => "edit","pfile_id" => "pfile_id"))); $toolbuilder->tool(array("confirm" => $modul['error']['confirm_delete'],"label" => "Delete","href" => $PHP_SELF,"params" => array("action" => "delete_single","pfile_id" => "pfile_id"))); $databrowser->tools = $toolbuilder; for ($i=0; $i < sizeof($databrowser->data); $i++) { $databrowser->data[$i]['pfile_date_created'] = nice_date("l d F Y",$databrowser->data[$i]['pfile_date_created']); $databrowser->data[$i]['pfile_file'] = '<a href="/PDF/Test_PDF/'.$databrowser->data[$i]['pfile_file'].'">'.$databrowser->data[$i]['pfile_file'].'</a>'; } $paginator->render(); $databrowser->render(); $paginator->render(); echo '<div class="clear"></div>'; if ($action == "edit") { $formbuilder->fields_as_array = "pfile"; $formbuilder->data = $mysql->data_get_single("productfiles","pfile_id",$_GET['pfile_id']); $formbuilder->fields = array($module['data']['types']['pfile_id'],$module['data']['types']['pfile_date_created'],$module['data']['types']['pfile_description'],$module['data']['types']['pfile_file']); echo '<form action="productfiles2.php" method="post">'; echo '<input type="hidden" name="action" value="edit_single" />'; echo '<h2>Edit Productfile</h2>'; echo $formbuilder->fields(); echo '<input type="submit" id="submit" name="submit" value="Confirm" />'; echo '</form>'; } else { $formbuilder->fields_as_array = "pfile"; $formbuilder->fields = array($module['data']['types']['pfile_date_created'],$module['data']['types']['pfile_description'],$module['data']['types']['pfile_file']); echo '<form action="productfiles2.php" method="post" enctype="multipart/form-data">'; echo '<input type="hidden" name="action" value="add_single" />'; echo '<h2>New Productfile</h2>'; echo $formbuilder->fields(); echo '<input type="submit" id="submit" name="submit" value="Confirm" />'; echo '</form>'; } Link to comment https://forums.phpfreaks.com/topic/167026-pagination-link-doesnt-work-newbie/ Share on other sites More sharing options...
seventheyejosh Posted July 22, 2009 Share Posted July 22, 2009 can you edit your post and put [ php ] [ /php ] (no spaces) tags around your code u have there? Link to comment https://forums.phpfreaks.com/topic/167026-pagination-link-doesnt-work-newbie/#findComment-880651 Share on other sites More sharing options...
ldougherty Posted July 22, 2009 Share Posted July 22, 2009 If it is always showing the same result set its likely that your variables are not being set to what you believe they are. I'd start echoing out variables through out the code before they come into play to see exactly what aspect of your code isn't working properly. Link to comment https://forums.phpfreaks.com/topic/167026-pagination-link-doesnt-work-newbie/#findComment-880720 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.