Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

SQL Statement on a .PHP page?

Avatar of kenuk110
kenuk110 asked on
Web Applications
12 Comments1 Solution182 ViewsLast Modified:

I have a query within a .PHP page (attached). I'm trying to format the query as follows:

If WarningLetterToBeIssued = Yes then DON'T display the record


If DocsReceived = Yes AND DocsConfirmed = Yes AND DocsScanned = Yes then DON'T display the record.

What is happening is that only if all = Yes will the record not be displayed.

Any ideas how the query should be formatted? The attached code looks like a right mess, not sure if it's easier to read as an attached file, let me know if you need it.

Best Regards

mysql_select_db($database_T1, $T1);
$query_WADATAS_BTW = "SELECT pk, BTWDate, AssociateID, AssociateName, ARFDocsRecievedConfirmed, DocsReceived, DocsConfirmed, DocsReviewDate, DocsScanned, WarningLetterToBeIssued FROM TAS_BTW WHERE (WarningLetterToBeIssued <> 'Yes') OR (DocsReceived <> 'Yes') AND (DocsConfirmed <> 'Yes') AND (DocsScanned <> 'Yes') ";
$query_limit_WADATAS_BTW = sprintf("%s LIMIT %d, %d", $query_WADATAS_BTW, $startRow_WADATAS_BTW, $maxRows_WADATAS_BTW);
$WADATAS_BTW = mysql_query($query_limit_WADATAS_BTW, $T1) or die(mysql_error());
$row_WADATAS_BTW = mysql_fetch_assoc($WADATAS_BTW);
Avatar of Ionut A. Tudor
Ionut A. TudorFlag of Romania imagePHP Programmer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 12 Comments.
See Answers