Say i have a query "select username from users". I want to output this query onto a PHP page but after every 10th row i want to display my own custom text. Any ideas? and it will continue from the 11th record.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
The simplest way would be to pull the data table back, loop through the rows, writing each one out while keeping track of the row you are on. Then every tenth iteration, write out your custom message.
If you are using PDO to run your mysql query, you can create a variable in PHP and then limit your query by that variable.
here's an incomplete example, but you may get the idea.