I'm trying to get multiple values outside the while loop to use it in the query outside the while loop also. Now I can just get one value at a time. The values that I'm trying to get is this one $ids=$row["curriculum_id"];
This is my code, any help would be highly appreciated.
<?php
if(isset($_POST['Submit']) AND $_POST['Submit'] == 'Submit')
{
$coursneededdate =$_POST['needed'];
$coursneededdate =mysqli_real_escape_string($mysqli,$coursneededdate);
$gradunder=$_POST['gradunder'];
$gradunder =mysqli_real_escape_string ($mysqli,$gradunder);
$avalablesemster= $_POST['avalable'];
$avalablesemster =mysqli_real_escape_string($mysqli,$avalablesemster);
$sql = "SELECT * FROM curriculum where '".$coursneededdate."' between startdate and enddate";
$result = $mysqli->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$ids=$row["curriculum_id"];
}
}
}
$result2 ="SELECT * FROM curriculumcourses INNER JOIN courses ON curriculumcourses.course_id = courses.course_id where curriculum_id='$ids' and semester_ava='$avalablesemster'";
$result3 = $mysqli->query($result2);
if ($result3->num_rows > 0) {
while($row = $result3->fetch_assoc()) {
echo "<pre>";
print_r($row);
}
}
?>