Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/10/2021 in all areas

  1. Rather than passing two variables in the URL, just pass one called 'page'. You can use that to calculate your $to/$from variables. $recordsPerPage = 10; $page = max($_GET['page'], 1); $from = ($page - 1) * $recordsPerPage; $to = $from + $recordsPerPage; For the previous button, disable it if $page == 1. To handle your next button, you need to do a query to count the total possible results. Take the same query you'd use to obtain your paginated data and remove the LIMIT clause and replace the selected columns with CEIL(COUNT(*)/10) as totalPages. Once you have the total page count you can compare it to $page to determine whether or not to enable the next button.
    1 point
  2. Generally, I would agree with that. However, I wonder if there would be legal reasons for keeping a copy of the invoice that was sent. Yes, another copy could be generated later and would be the same - if the code had not changed. But, if there was any type of legal action and the company needed to provide records of the invoices that were sent, I don't know if regenerating a copy would be adequate. They might have to also prove that none of the code changed that generated the invoice and if the code had changed they might have to prove what the invoice would have looked like at the time it was generated previously.
    1 point
  3. For future reference, rather changing the value of display directly like that, it's easier to just add/remove a class which will apply display: none; Doing it that way, you don't have to worry about whether it should be 'block', 'inline', 'table-cell', 'grid', etc. You just apply display: none; with a class to hide it, then remove the class so display: none; gets removed and it falls back to whatever the previous value was.
    1 point
  4. Nicer than storing generated PDFs on your server is generating them at the time they're needed. Because, at least in the case of invoices, the data supporting its contents shouldn't ever change.
    1 point
  5. It's not exactly easy to tell what it is you're describing, but I think the general term you're looking for is "front controller": where most/all code doesn't start off by executing individual .php files but instead everything goes through one file (typically index.php) which then has some amount of logic to determine what code should be running. That process can start with URL rewriting (telling the web server that everything should go through index.php) or simply using specially-crafted URLs (such as query strings like /my_directory/?stuff or PATH_INFOs like /index.php/stuff); the former is the modern approach.
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.