Jump to content

Mysql help with Query


zaidy26

Recommended Posts

Hi guys this is my first post, new to web development so please forgive me for my ignorance.

 

Ok , i,m busy with a site , where im running ads , i display ads on a page and keep a counter in a database of the number of page refreshes i have  and the number of adds

 

i have . so for instance if i am on 600 page refreshes and i have 20 adds , i divide 600 by 20 and use the remainder number which will always be between 0 and 19.

 

Ok now i need to query my ads database and display ads where the add id is greater the the remainder i get from the above query , so if my remainder was 3 , i want to show add 4 , 5 , 6 , 7 , my problem is , say the remainder was 19 , it needs to show add 20 , 1 , 2 3 . so it must start back at one , so i cant use the > operator , because it wont bring 1 2 3, 

 

Currently im saying

SELECT *

FROM kokan_ads

WHERE kokan_ads.id > $remainderdnumber

but this will only work fine till you reach a point where it must restart.

 

Any help please

Link to comment
https://forums.phpfreaks.com/topic/217828-mysql-help-with-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.