Cannot seem to find a post addressing this particular issue. The SQL query (as below) works fine when I execute from shell but in php it is throwing an undefined index. I think the problem is that it is not recognising the disambiguation of attributes when in php.
Error I get in php is:
Notice: Undefined index: s.RowNumber in /home/xx/xx/xxx/xxx/checkAvailability.php on line 14.
Code:
<?php
include'connect.php'
?>
<form method="post" action="chooseDate.php">
<?php
$sql = "SELECT s.RowNumber
FROM Seat AS s LEFT JOIN Booking AS b
ON s.RowNumber = b.RowNumber
AND b.PerfDate = '2016-12-12'
AND b.PerfTime = '20:30:00'
WHERE b.RowNumber IS NULL";
$handle = $conn->prepare($sql);
$handle->execute();
$res = $handle->fetchAll();
foreach($res as $row) {
echo "<input name='Seat' type='checkbox' value=".$row['s.RowNumber']."><br>";
}
?>
<input class="mybutton" type="submit" value="Choose Date"/>
</form>
Can anyone elaborate on the problem? Thanks in advance.