I want to store the first query result in a variable and use the first query result as a value in the second query.
Currently the second query works on its own. I am just having difficulties getting the first one to work.
$var = array();$idorigin = $conn->prepare("SELECT id_stop FROM stops WHERE
stopname = '$value1'");
$var = $idorigin['id_Stop'];
$stmt = $conn->prepare("SELECT id_stop, scheduletime FROM schedule
WHERE scheduletime >= '$time' AND id_stop = '8'
You could use something like this for your first statement :
$req = $conn->prepare("SELECT id_stop FROM stops WHERE stopname = :value"); $req->execute(array('value' => $value1)); $result = $req->fetchAll(); $req->closeCursor(); var_dump($result);
Hope this helps