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

Thanx in advance

i Got the result myself and answer is

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

bye

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¿¿

<?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 is field name )

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.