hello guys! i have a table of doctors with following columns given
below and i am want to fetch details by date using submit button.
but i cant filter the queries for details of same table.i am
converting the date to specific day and storing it in $day variable
and id in $available variable through transferring the value of
session variable from previous page and implementing in two sql
queries can anyone plz guide me.i am sorry for any typing mistake
because i am a beginner.
doctors:
id doctorname date1 day1 day2 day3 day4 day5 day6 day7
1 arvind 2018-05-29
2 sonal 0000-00-00 mon tue wed thu fri sat sun
3 harry 0000-00-00 mon tue wed thu
<?php
session_start();
include 'connect.php';
if(isset($_GET['submit'] ))
{ $date=$_GET['date'];
$available= $_SESSION['available'];
$day=date('l', strtotime($date));
$sql=mysqli_query($mysqli,"SELECT id,specilization,doctorName,
docFees, starttime, endtime,date1 FROM doctors WHERE
id= '$available' AND cast(date1 as date) = '$date'" )
UNION
SELECT id,specilization,doctorName, docFees, starttime, endtime,date1
FROM doctors WHERE id= '$available' AND DAY1='$day' OR DAY2='$day' AND
DAY3='$day' OR DAY4='$day' AND DAY5='$day' OR DAY6='$day' OR
DAY7='$day'");
$row = mysqli_fetch_array($sql);
If(empty($_GET['date']))
{ echo "ENTER DATE PlEASE";}
elseif($row1>1)
{echo "Day:". $day;
echo "<br>";
?> <tr>
<td><?php echo $row1['id'];?></td>
<td><?php echo $row1['specilization'];?></td>
<td><?php echo $row1['doctorName'];?></td>
<td><?php echo $row1['docFees'];?></td>
<td><?php echo $row1['starttime'];?></td>
<td><?php echo $row1['endtime'];?></td>
<td><?php echo $_SESSION['bdate'];?></td>
</tr>
</table>
<?php }?>