I want to query an id value from a table, based on the stopname that user inputs - Table:
id_stops stopname
1 Eastgate
2 CityCenter
and store the value in a variable so it can be used in another query
The second query runs when the id_stop = '' value is an int, the problem is storing the first query value so it can be used instead of typing the int.
$req = $conn->prepare("SELECT id_stop FROM stops WHERE stopname = :value");
$req->execute(array('value' => $value1));
$result2 = mysql_query($reg);
$value = mysql_fetch_assoc($result2,0);
echo $value;
$stmt = $conn->prepare("SELECT id_stop, scheduletime FROM schedule
WHERE scheduletime >= '$time' AND id_stop = '$value'
ORDER BY scheduletime DESC LIMIT 2;");
$stmt->execute();