How to pass value inside row array to another variable since the result of the row array I need to do another query for selection in other table. In both echo $row['Plate']
and $plateID
can show the value, but for another query doesn't show the result. This is my code:
<?php
$connection=mysqli_connect("localhost","root","");
$db=mysqli_select_db($connection,'db_car_identification');
$q="SELECT Plate FROM addplate ORDER BY ID DESC LIMIT 1 ";
$result=mysqli_query($connection,$q);
while($row = mysqli_fetch_array($result)) {
echo $row['Plate'];
$plateID = $row['Plate'];
echo $plateID;
$query="SELECT StuName FROM student_detail WHERE plateID=$plateID";
$query_run=mysqli_query($connection,$query);
while($row1=mysqli_fetch_array($query_run)) {
echo $row1['StuName'];
}
}
?>