Hi
I want to display random articles in my homepage from "article" table in my database
how can I do that?
thanks
random database select
Moderator: General Moderators
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Code: Select all
SELECT `content` FROM `table` ORDER BY RAND() LIMIT 0, 1;- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Choose the Right Board
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:1. Select the correct board for your query. Take some time to read the guidelines in the sticky topic.
thanks:Psuperdezign wrote:Code: Select all
SELECT `content` FROM `table` ORDER BY RAND() LIMIT 0, 1;
what should be instead of "content"?
and what's the job for limit 0,1?
You'll learn a lot more a lot faster if you learn to look for an answer in the MySQL manual first. We could tell you the specifics, but reading the manual will give you much more information.m2babaey wrote:thanks:Psuperdezign wrote:Code: Select all
SELECT `content` FROM `table` ORDER BY RAND() LIMIT 0, 1;
what should be instead of "content"?
and what's the job for limit 0,1?