I have a code very similar to the one in the photo, in the part that says '$gte' => 18
I just want to replace 18 with a variable that the user enters. I already have the variable and tried with '$gte' => $num
but it does not work for me. What is the correct way to do this?
<?php
$personas = $bd->personas;
$personas->insert(array("nombre" => "Joe", "edad" => 4));
$personas->insert(array("nombre" => "Sally", "edad" => 22));
$personas->insert(array("nombre" => "Dave", "edad" => 22));
$personas->insert(array("nombre" => "Molly", "edad" => 87));
$edades = $bd->command(
array(
"distinct" => "personas",
"key" => "edad",
"query" => array("edad" => array('$gte' => 18))
)
);
foreach($edades['values'] as $edad)
{
echo "$edad\n";
}
?>
Image of the code: link