PHP: Best way of running a flip flop from one query to another query efficiently

170
May 25, 2017, at 11:39 AM

I need to pull data from a database like so
//Query is just a function I made to run queries, nothing special

echo "<div class="row5">";
$query = query("SELECT * FROM `table` LIMIT 5");
echo "</div>";
echo "<div class="row4">";
$query = query("SELECT * FROM `table` LIMIT 4");
echo "</div>";
echo "<div class="row5">";
$query = query("SELECT * FROM `table` LIMIT 5");
echo "</div>";

The problem is I need to do that idea many many times. Right now I have it run a query then store the highest id and start up a new query beginning at that id. It's very inefficient but I don't know how else to do it.

Also is something like that hard on a server? I have no idea how many queries is an ideal max for a single page load.

READ ALSO
Mysql - Create sample data from existing rows

Mysql - Create sample data from existing rows

I have a table with about 50K rowsI need to multiply this data 10 fold to have at least 5M rows for testing the performance

217
Get records GROUPing BY and discarding duplicates

Get records GROUPing BY and discarding duplicates

I have a "transaction_status" table:

166
SQL SUM function giving incorrect values

SQL SUM function giving incorrect values

I have written this code and I'm finding that the values are in the thousands when they should be only in the hundreds at most

208