473,548 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

merge two select queries of same table and filter details

1 New Member
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_que ry($mysqli,"SEL ECT id,specilizatio n,doctorName,
docFees, starttime, endtime,date1 FROM doctors WHERE
id= '$available' AND cast(date1 as date) = '$date'" )
UNION
SELECT id,specilizatio n,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_ar ray($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, 67 views)
May 25 '18 #1
0 1493

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

Similar topics

2
2046
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
3390
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 I use most frequently in select queries. The data is about 100MB and index is 80MB. The table has the following structure: CREATE TABLE `ptimes`...
6
8507
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
5219
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
12876
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 something like insert all into supertask (name,desc,rstrnum) select name, desc, rstrnum from supertask;
5
7604
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
9429
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 same table with a where clause its taking a IS table lock. This is causing the select to go on lock waiting. The application cannot do UR isolation...
1
1519
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 not match Query2.CaseID. CaseID is what I use to join the queries. What I am trying to do is merge both Queries and make them into one Query. ...
14
6662
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 samples for them to review the accounts. I was making a suggestion to my team that maybe if we only ran one Cognos query and pulled in all of the columns...
9
1330
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 --Building Name, Room Name --Equipment name, equipment serial number, equipment IP address
0
7438
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7707
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7951
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7466
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6036
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5362
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3495
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3475
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
751
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.