Can't seem to figure out where my SQL query is incorrect as I have tested each query in phpMyAdmin and they are giving results.
I'm attempting to display this data in a table below as well, but that works fine. The all function seems to be displaying correctly but when I select a month from the drop down menu it gives me the titled error
<?php
$total = 0;
$term1 = 0;
$term2 = 0;
if(isset($_POST["Month"])==null)
{
$total = mysqli_query($connection,"select count(terminal) from arrivals");
$term1 = mysqli_query($connection,"select count(terminal) from arrivals where terminal = 't1'");
$term2 = mysqli_query($connection,"select count(terminal) from arrivals where terminal = 't2'");
}
elseif($_POST["Month"]=="All")
{
$total = mysqli_query($connection,"select count(terminal) from arrivals");
$term1 = mysqli_query($connection,"select count(terminal) from arrivals where terminal = 't1'");
$term2 = mysqli_query($connection,"select count(terminal) from arrivals where terminal = 't2'");
}
else
{
//$total = mysqli_query($connection,"select count(terminal) from arrivals where scheduledDate like '%-$months1-%'");
//$term1 = mysqli_query($connection,"select count(terminal) from arrivals where terminal = 't1' and scheduledDate like '%-$months1-%'");
//$term2 = mysqli_query($connection,"select count(terminal) from arrivals where terminal = 't2' and scheduledDate like '%-$months1-%'");
}
$row=mysqli_fetch_array($total);
$row1=mysqli_fetch_array($term1);
$row2=mysqli_fetch_array($term2);
print("<table border= 1>");
print("<tr>");
print("<th>");
print("Total Flights");
print("</th>");
print("<th>");
print($row[0]);
print("</th>");
print("</tr>");
print("<tr>");
print("<th>");
print("Terminal 1");
print("</th>");
print("<th>");
print($row1[0]);
print("</th>");
print("</tr>");
print("<tr>");
print("<th>");
print("Terminal 2");
print("</th>");
print("<th>");
print($row2[0]);
print("</th>");
print("</tr>");
print("</table>");
mysqli_close($connection);
?>