administrator Posted October 26, 2018 Report Posted October 26, 2018 Hi, Very few will want to go through your code to debug it. So please try to narrow it down - cut it up into chunks to isolate the error.
RobZ Posted October 27, 2018 Report Posted October 27, 2018 I got it working. MySQL would not accept null values
EmadS Posted October 28, 2018 Report Posted October 28, 2018 Hi Ben, I don't know how to make php display the error, i have editephp.ini and still cannot see what's the error message: i know it's a syntax error but i don't know where? please help.
administrator Posted October 28, 2018 Report Posted October 28, 2018 It's a HTTP 500 error ... which means the whole web server went nuts. So, first thing is to strip all PHP from the page to get the page loading at least. Then step by step, add the PHP to see what breaks it. Stef
LiverSite Posted September 29, 2019 Report Posted September 29, 2019 (edited) My dear friend Falken, I just registered to the forum to ask you a question. Is there any chance tonight or tomorrow you will update your PHP Pagination Tutorial so Ajax, jQuery and Prepared Statements are used ? That way, whole pages won't need reloading to update data on our pagination pages. Plus we get SQL injection proof added. I am a PHP Student. Still on procedural style and Mysqli and prepared statements. Haven't got into pdo or Oop style or JavaScript or any other programming language yet. Also your pagination contains the page number links at the top of the page. Would be great if there were a copy on the bottom of the page too. Also can you update it to make it Mobile Responsive for all devices ? Don't bother revolving around Twitter's bootstrap as better not to be dependant on a commercial company's template. Do drop me a PM after you've updated your tutorial to 2019 standard. PS - May we see a PHP Mysqli & Prepared Statement tutorial from you on Member Registration & Login site ? And another tutorial where you teach us how to build a search chengine (Search feature, Crawler, Index, etc) with mysqli and prepared statements and Ajax and jQuery ? Thank You! Edited September 30, 2019 by LiverSite
ianhaney Posted October 17, 2019 Report Posted October 17, 2019 (edited) I am using this script and all works fine but is it possible to add a active class to the pagination so when on page 6 for example, the number 6 is highlighted so know which page number I am on, below is the current code I have // Count the total records $total_records = mysqli_num_rows($result); //Using ceil function to divide the total records on per page $total_pages = ceil($total_records / $per_page); //Going to first page echo "<div class='btn-group' style='margin:0 auto;display:table;'>"; echo "<br><br><center><a href='view-all-customers.php?page=1' class='btn btn-primary float-button-light' style='color:#FFFFFF;padding:6px 15px;'>".'First Page'."</a>"; for ($i=1; $i<=$total_pages; $i++) { echo "<a href='view-all-customers.php?page=".$i."' class='btn btn-primary float-button-light' style='color:#FFFFFF;padding:6px 15px;'>".$i."</a>"; }; // Going to last page echo "<a href='view-all-customers.php?page=$total_pages' class='btn btn-primary float-button-light' style='color:#FFFFFF;padding:6px 15px;'>".'Last Page'."</a></center>"; echo "</div>"; UPDATE: I managed to get it working using the following coding //check page and add active class for ($i=1; $i<=$total_pages; $i++) { $isActive = ''; if($i == $page){ $isActive = 'active'; } echo "<a href='view-all-customers.php?page=".$i."' class='".$isActive."btn btn-primary float-button-light' style='color:#FFFFFF;padding:6px 15px;'>".$i."</a>"; }; The complete code is below if anyone else needs it // Count the total records $total_records = mysqli_num_rows($result); //Using ceil function to divide the total records on per page $total_pages = ceil($total_records / $per_page); //Going to first page echo "<div class='btn-group' style='margin:0 auto;display:table;'>"; echo "<br><br><center><a href='view-all-customers.php?page=1' class='btn btn-primary float-button-light' style='color:#FFFFFF;padding:6px 15px;'>".'First Page'."</a>"; //check page and add active class for ($i=1; $i<=$total_pages; $i++) { $isActive = ''; if($i == $page){ $isActive = 'btn-active'; } echo "<a href='view-all-customers.php?page=".$i."' class='".$isActive." btn btn-primary float-button-light' style='color:#FFFFFF;padding:6px 15px;'>".$i."</a>"; }; // Going to last page echo "<a href='view-all-customers.php?page=$total_pages' class='btn btn-primary float-button-light' style='color:#FFFFFF;padding:6px 15px;'>".'Last Page'."</a></center>"; echo "</div>"; Edited October 17, 2019 by ianhaney solved the issue
Recommended Posts