100 entries. How to deduce from a DB 5 last records, thus without considering the last 20?
Ie should be removed records from 80 to 75.
This code can count the number of rows in the database:
$q="SELECT count(*) FROM ΠΈΠΌΡ_Π±Π°Π·Ρ"; $res=mysqli_query($mySQL, $q); $row=mysqli_fetch_row($res); $total_rows=$row[0]; And with such a request, get 5 records excluding the last 20
$end = $total_rows - 25; \\ Π‘ΡΠΈΡΠ°Π΅ΠΌ, Ρ ΠΊΠ°ΠΊΠΎΠΉ ΡΡΡΠΎΠΊΠΈ Π±ΡΠ΄Π΅ΠΌ Π±ΡΠ°ΡΡ \\ SQL Π·Π°ΠΏΡΠΎΡ Ρ Π»ΠΈΠΌΠΈΡΠΎΠΌ "SELECT * FROM ΠΈΠΌΡ_Π±Π°Π·Ρ ORDER BY `id` DESC LIMIT ".$end.",5" I think it will go like this:
SELECT * FROM ΠΈΠΌΡ_Π±Π°Π·Ρ ORDER BY `id` DESC LIMIT 20, 25 Source: https://ru.stackoverflow.com/questions/699746/
All Articles
LIMITfor example, to specify from which record and how much to output - NTPLIMIT 20,5- Akina