954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Select random database value?

I m working on advertise website for that i need to select random values from the database
so please help me

Thanx in advance

nikesh.yadav
Posting Whiz in Training
219 posts since Feb 2008
Reputation Points: 15
Solved Threads: 21
 

i Got the result myself and answer is

SELECT * FROM tablename ORDER BY Rand() LIMIT 0,30


bye

nikesh.yadav
Posting Whiz in Training
219 posts since Feb 2008
Reputation Points: 15
Solved Threads: 21
 

i Got the result myself and answer is

SELECT * FROM tablename ORDER BY Rand() LIMIT 0,30

bye

Hey thanks allot for the information... just have a small question about the 0,30 numbers in the code, those mean how many units of data will choose¿¿

Vledic
Newbie Poster
1 post since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

<?php
ob_start();
include("conn.php"); //connection file
$sql = "select* from tablename order by rand()"; (rand is function of php not a field)
$query = mysql_query($sql);
$data = mysql_fetch_array($query);

?>

<?php echo $data['m'];?> ( m is field name )

thanks

anupam294
Newbie Poster
1 post since Jun 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You