PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
that will return 1 result, (LIMIT 1) so there's no point in counting the rows with mysql_num_rows. according to your criteria, it will select a random row where your criteria is met.
if you need to get the total number of rows returned, and then select a random one, you could do something like this
## count the rows
$result = mysql_query("SELECT count(*) FROM `table` WHERE `foo` = '$bar'");
$num_results = mysql_result($result,0);
mysql_free_result($num_results);
## select a random row
$random = mysql_query("SELECT `value` FROM `table` WHERE `foo` = '$bar' ORDER BY rand() LIMIT 1");
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.