473,513 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble with Query using DWMX

Have a problem with this query, when xBatch is empty or at least seems
to be empty.

Using DWMX, MySQL, and PHP

SELECT donations.id, donations.batch, donations.oikos_id,
donations.giftDate, donations.genFund, donations.misFund,
donations.benFund, donations.notes, oikos.id, oikos.famLabel
FROM donations, oikos
WHERE IF(xBatch = '', donations.batch > 0, donations.batch = xBatch) AND
donations.oikos_id = oikos.id
ORDER BY donations.batch, donations.giftDate, donations.oikos_id

xBatch = $HTTP_GET_VARS['searchBatch'] - Comes from a form field named
"searchBatch."

When "searchBatch" is empty and thus makes xBatch empty, I get the
following SQL error.

You have an error in your SQL syntax. Check the manual that corresponds
to your MySQL server version for the right syntax to use near '= '',
donations.batch > 0, donations.batch = ) AND donations.oi

Why isn't the conditional statement fixing the problem? Any suggestions?

-Dave
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
0 1291

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1652
by: Keith | last post by:
I have a SQL DB with a number of tables and queries (views) in. In front of this is my ASP app I am designing. When my users log in, their User ID is stored in a session variable. One of the...
0
1037
by: David McCowan | last post by:
Have a problem with this query, when xBatch is empty or at least seems to be empty. Using DWMX, MySQL, and PHP SELECT donations.id, donations.batch, donations.oikos_id, donations.giftDate,...
2
3940
by: Display Name | last post by:
I can't insert an image using the "add a new stylesheet" function- the function, on dreamweaver MX (i'm on Windows 2k Pro) seems to work as it generates the code... but the image never shows up in...
59
7433
by: Rico | last post by:
Hello, I have an application that I'm converting to Access 2003 and SQL Server 2005 Express. The application uses extensive use of DAO and the SEEK method on indexes. I'm having an issue when...
3
1854
by: fstenoughsnoopy | last post by:
Ok the complete story. I have a Contact Table, Query and Form, that are used to input and store the contact info for customers. They have FirstName, LastName and Address as the primary key...
0
1835
by: harry12 | last post by:
Hello- I'm fairly new at using Microsoft Access and I'm having trouble getting a couple of things to work in my database. The first is that I have yet to find a way to get an append query to...
1
2046
by: ferraro.joseph | last post by:
Hi, I'm querying Salesforce.com via their AJAX toolkit and outputting query results into a table. Currently, their toolkit does not possess the ability to do table joins via their structured...
11
3741
by: kennthompson | last post by:
Trouble passing mysql table name in php. If I use an existing table name already defined everything works fine as the following script illustrates. <?php function fms_get_info() { $result =...
1
1936
by: nico3334 | last post by:
I'm having trouble with a query using "MAX". In my query I'm trying to use 2 date columns as my criteria. Here is the format for each column: Date1: 01/01/2007 Date2: 200701 For my...
5
13306
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
7171
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...
0
7388
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,...
0
7545
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...
1
7111
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...
0
7539
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5692
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,...
0
3240
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...
0
1605
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
461
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...

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.