jeudi 24 septembre 2015

PHP MySQL select random value from table

I am trying to get a random city from the location table but is not working, I have searched over Stack and tried many ways still not getting it work.

<?php  include "../database.php"?>
<?php

$sSQLQuery = mysql_query("SELECT city FROM location ORDER BY RAND() LIMIT 1;");

$aResult = mysql_query($sSQLQuery); 

?>

<span class="h3"><?php echo $aResult ?></span>




Aucun commentaire:

Enregistrer un commentaire