0

hi, i havent been able to retrieve a random row from my database hourly, daily and weekly.
i need to display a row (doesnt matter if it repeats) but i need to make it change in one page hourly, another daily, and other weekly. For promotion.

how could the code be or what should i do?

3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by blocblue
0

1 what is table structure?
2 what are records?
3 how you want to display that records?
4 what do u mean by hourly, another daily, and other weekly (all in one query or u want in different pages?)

0

1.- My table structure is : table name: juarez, has product_id product_name product_image product_ info
2.- the records are just some products the store owns
3.- im going to display the record in a div with the image but i dont have any trouble with that code
4.- each (hourly, daily, and weekly) are in different queries and recordsers, because they go in different pages. I dont have trouble in the code or display, just the code of the sql. i dont know where to start with that

0

all 2-4 questino you answered is not what i expected

answer 2
give me sample data
like
product_id product_name product_image product_ info
1, abc, abc.jpg,its is abc prodcut
2, pqr, pqr.jpg,its is pqr prodcut

answer 3,4 (first take hourly)
i m not asking where u diplay, i want to know HOW u want to display. write sample output here, that what u expect from above table data.

hourly, daily, weekly is time related things, and your table do not have any date time column

1

You can seed the RAND() function with an integer value.

If you were to use the current hour of the day as the seed for example, then your query would return the same results in the same order for a whole hour, and then change during the subsequent hour, and so on.

E.g.

SELECT * 
FROM `juarez` 
ORDER BY RAND(HOUR(NOW())) 
LIMIT 1

Edited by blocblue

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.