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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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