'0'"; //condition
$resREC = mysqli_query($mysqli, $sqlREC); // Store query results
if ($resREC) // If there is a result:
{
$ResultsCounter = 0;
while ($newarrayREC=mysqli_fetch_array($resREC, MYSQLI_ASSOC))
{
$ResultsCounter ++;
}
$_SESSION['MaxPage'] = $ResultsCounter; // For the page turner scripts
}
else {printf("Could not read record: %s\n", mysqli_error($mysqli));}
#-------------------------------------------------------------------------------
#----------GENERATE 3 RANDOM INDEX NUMBERS IN THE AVAILABLE RANGE---------------
srand(date("z"));
$sp1 = rand (1,$ResultsCounter/3);
$sp2 = rand (($ResultsCounter/3)+1,$ResultsCounter*2/3);
$sp3 = rand (($ResultsCounter*2/3)+1,$ResultsCounter);
echo $num1.$num2.$num3;
# --------------------------------RECIPE RETRIEVAL ENGINE ----------------------
$sqlREC ="SELECT * FROM recipes WHERE recipe_index = '$sp1' OR recipe_index = '$sp2' OR recipe_index = '$sp3'"; //condition
$resREC = mysqli_query($mysqli, $sqlREC); // Store query results
if ($resREC) // If there is a result:
{
$ResultsCounter = 0;
while ($newarrayREC=mysqli_fetch_array($resREC, MYSQLI_ASSOC))
{
$ResultsCounter ++;
$RecipeIndex[$ResultsCounter] = $newarrayREC["recipe_index"];
$Name[$ResultsCounter] = $newarrayREC["name"];
$Headline[$ResultsCounter]= $newarrayREC["headline"];
}
}
else {printf("Could not read record: %s\n", mysqli_error($mysqli));}
mysqli_free_result($resREC);
#-------------------------------------------------------------------------------
?>