473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

merge two select queries of same table and filter details

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 }?>
Attached Images
File Type: jpg doc.jpg (21.6 KB, 66 views)
May 25 '18 #1
0 1476

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Bob Bedford | last post by:
I've 2 tables where I want to retrieve the id and name from and merge them: table1: IDtable1-nametable1 1 - 578445 2 - 454545 3 - 554887 table2: IDtable2-nametable2
9
by: mfyahya | last post by:
Hi, I'm new to databases :) I need help speeding up select queries on my data which are currently taking 4-5 seconds. I set up a single large table of coordinates data with an index on the fields...
6
by: laurenq uantrell | last post by:
Is it possible to use With (NOLOCK) and With (READPAST) in the same SELECT query and what whould be the syntax? @param int SELECT myRow FROM dbo.myTable WITH (NOLOCK) WHERE
1
by: BoxRec | last post by:
Can some kind soul please help me turn this into sql UPDATE TableA SET rowA.colA = rowB.colB WHERE rowA.colC = rowB.colD
1
by: sudhendra | last post by:
I have a table supertask; which has 24 rows. The table as a primary_key called id. I would like just recursively copy rows into same table. supertask_id is auto generated. So All I need to do is...
5
by: Lennart | last post by:
I really like the construction: select * from new table (update ....) X but I noticed that it cant be used as: insert into T select * from new table (update ....) X because of:
5
by: Roger | last post by:
I am doing some mass update on DB2 8.2 FP10 (say 400 to 500 rows on a 5000 row table) with just one commit. So this is taking lot of exclusive row locks as expected. When I run a select on the...
1
by: AccessHunter | last post by:
Please help... I have 2 queries with the same type of information, Query1 has the columns - CaseID, PlaceDate, MailDate, Before, After Query2 also has the same columns, but Query1.CaseID does...
14
by: Supermansteel | last post by:
My team at work uses Cognos to run multiple queries to pull in data. Then they take that data and import into Access and then usually run an Append Query to run a RND function to pull out a few...
9
by: ittechguy | last post by:
I have a problem I've been trying to fix for the past two weeks. I'm trying to create a search form which filters : --Customers first name, last name, organization, shop name, office symbol ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.