I used the following code to retrieve a bunch of rows from a database:
$sql="SELECT * FROM Homes WHERE FeatureHome=TRUE";
$result = mysql_query($sql);
$numrows = mysql_num_rows($result);
$random1=rand(0,$numrows);
$random2=rand(0,$numrows);
$random3=rand(0,$numrows);
$random4=rand(0,$numrows);
and now what I want to do is select 4 random rows from $result based on the 4 random numbers generated.
Also, is the "WHERE FeatureHome=TRUE" the correct way to check a binary variable in SQL?
Thanks in advance.
$sql="SELECT * FROM Homes WHERE FeatureHome=TRUE";
$result = mysql_query($sql);
$numrows = mysql_num_rows($result);
$random1=rand(0,$numrows);
$random2=rand(0,$numrows);
$random3=rand(0,$numrows);
$random4=rand(0,$numrows);
and now what I want to do is select 4 random rows from $result based on the 4 random numbers generated.
Also, is the "WHERE FeatureHome=TRUE" the correct way to check a binary variable in SQL?
Thanks in advance.