1,105,644 Community Members

sql query get random data

Member Avatar
hwoarang69
Posting Pro
572 posts since Feb 2012
Reputation Points: -4 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 9 [?]
 
0
 

i have this query:

$item_query = mysql_query("SELECT * FROM item");

this will always get the data from 1st row to bottom row.

how can i get random data?

SELECT * FROM item  ORDER BY RAND()
or
SELECT * FROM item ORDER BY NEWID()

i want the best way to get random data.

Member Avatar
pritaeas
mod_pritaeas
11,315 posts since Jul 2006
Reputation Points: 1,420 [?]
Q&As Helped to Solve: 1,835 [?]
Skill Endorsements: 156 [?]
Moderator
Featured
Sponsor
 
1
 
Question Answered as of 1 Year Ago by pritaeas
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article