PHP Questions Home | Register | Login
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website
Unanswered

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

How do I return a random row from the database?


If you wish to return a row at random from your mysql database, then simply use the rand() structure in your query, like so:

<?php
$query 
mysql_query("SELECT name FROM millionsofnames ORDER BY rand() LIMIT 1");
?>



Comment on this Question and Answer >>>

ASK A QUESTION

More mysql PHP Questions

How do I access the current time with mysql?

I need to test database time needed to execute scryp (like 10 000 inputs) with what command i can start measuring time, start scrypt, and then to stop time when scrypt is done and get time resault?

I am unable to make pages for my search result.Below I am giving the code that I am using. Career Search result Yami says

how do i upload an image to database?

How do I find second highest value from a table?



Custom Search