473,378 Members | 1,658 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,378 software developers and data experts.

how to display AND and OR conditions IN QUERY

ditditsasa
MY CODE FOR THIS IS CORRECT?TELL ME

Expand|Select|Wrap|Line Numbers
  1. function fetchCancel_noshow( $from_date, $to_date, $patient_id = null, $provider_id = null, $apptstatus_id = null )
  2. {
  3.  
  4.     $where = "";
  5.     if ( $provider_id ) {
  6.     $where .= " AND e.pc_aid = '$provider_id'";
  7.     if ( $patient_id )  {
  8.         $where .= " AND e.pc_pid = '1'";
  9.  
  10.         $apptstatus_filter = " AND e.pc_apptstatus = ('!' OR '@')";
  11.         $where .= $apptstatus_filter;
  12.         } 
  13.     else {
  14.         $where .= " AND e.pc_pid != ''";
  15.         } 
  16.         }
  17.         $apptstatus_filter = " AND (e.pc_apptstatus ='!' OR e.pc_apptstatus ='@')";
  18.         $where .= $apptstatus_filter;
  19.  
  20.     $appointments = fetchEvents( $from_date, $to_date, $where );
  21.     return $appointments;
  22. }
THANKYOU IN ADVANCE
Jun 12 '12 #1
1 1149
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code.

You're the one that has to tell us if your code is correct or not. We don't know your business requirements, so there's no way for us to know. And if it's incorrect, you have to tell us what is incorrect. What is it doing that it's not supposed to and vice versa. What are the error codes and messages that you're getting?
Jun 12 '12 #2

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

Similar topics

2
by: ken | last post by:
I am using the query bellow to display some fielsd on my page and am having some problema displaying the data from calltime. I have the field setup in access as short time but when it is displayed...
1
by: Yisroel Markov | last post by:
Greetings, In Access 97 I have a subreport with two labels and a control. The record source for the control is a simple SQL query referring to another query: SELECT DISTINCTROW...
2
by: Not Me | last post by:
Hi, I have a table with a currency field, which is displayed via a form. If I open a query which displays this field (using the forms!myform.field notation) that field displays as though it's...
0
by: dbuchanan | last post by:
Hello, Is it possible to display a union query in a datagrid? If so how? If not what alternatives do I have? What I am trying to do...
7
by: jim Bob | last post by:
Can someone help? I need to execute strSQL = "SELECT * FROM qry_viewFDOExport" when a button is pressed and the results displayed in a list box. I want to do something like Dim db As Database...
2
by: Jerry M. Gartner | last post by:
Greetings: As evident from a previous post, I am a php noob. I would like to display MySQL query results in an html table with one of the row values as a category and the rest of the data...
3
by: DigitalWallfare | last post by:
Hi all, This is my first post here, but i've lurked for a while. I'm working on a website but have come across a major stumbling block in the code: I've managed to structure the search query...
1
by: madmod001 | last post by:
Hi there, Im wondering if any one can help with if possible a single SQL query what i am trying to achieve is a count on the rows only on active entries while also displaying only the single...
2
by: pizzaface | last post by:
I have created a table driven email notification system which sends emails using outlook to employees depending on if a boolean field (blnEmail) in the email notification table is set to TRUE. I'm...
4
by: Michael R | last post by:
Hello all. I have a Jet SQL question: I'm trying to write a query based on these 2 tables: table1: A: B: 1 1 2 1
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: 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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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...

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.