go2go
-
Posts
2 -
Joined
-
Last visited
Never
Posts posted by go2go
-
-
Can someone please help me creating a php file for the following codes:
$sql = 'SELECT * FROM library ORDER BY RAND() limit 5;';
where Database is: localhost
Database name is: lib
user: guest2
pass: guest2
Thanks
Displaying random records from a table
in PHP Coding Help
Posted
[code]
<?
// file test.php
$db=mysql_connect('localhost','user','pass');
mysql_select_db('database',$db);
$sql = "SELECT * FROM Table_NAME order by round() limit 5";
$result=mysql_query($sql)or die("query round problam");
?>
[/code]
The code seems to be working. BUT there was no display of records!!
I need to incorporate a template to display the 5 random records.
Any idea, please.