[PHP-DB] Selecting one random column from MySQL

2002-09-17 Thread Shoulder to Shoulder Farm
Hi all, How can I select one random column from a MySQL table? Thanks, Taj -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP-DB] Selecting one random column from MySQL

2002-09-17 Thread John Holmes
> How can I select one random column from a MySQL table? You can't, in one query. You can use the MySQL_ function to get a list of all the columns, though, and then use PHP to select a random column and construct an SQL statement. If you need to do something like this, though, there is somethin

Re: [PHP-DB] Selecting one random column from MySQL

2002-09-18 Thread Andrey Sosnitsky
Hello, Shoulder. You wrote 18 ñåíòÿáðÿ 2002 ã., 5:20:55: Do you mean random row? So, try this $query = "SELECT * FROM table ORDER BY RAND() LIMIT 1"; $result = mysql_query($query); etc... StSF> Hi all, StSF> How can I select one random column from a MySQL table? StSF> Thanks, Taj