SQLTeam.com | Weblogs | Forums

Issue date is null


#1

Hi

I am trying to write an insert statement and have a form with many dates on it.
Not all dates need to be filled in,but when I try to add a record to the database when all the date fields
are empty I an getting a syntax error.

In my table, I have created the date fields as follows (1 sample, I have 8 date fields on form)

......
row1_insltr VARCHAR(4),
row1_addl_ins VARCHAR(4),
row1_policy_number VARCHAR (20),
row1_policy_effective_date DATE DEFAULT NULL,
row1_policy_expiration_date DATE DEFAULT NULL

then when I go to get the date field, ex ample below:

$sR1_Eff_Date    = $_POST["R1_Eff_Date"];
$sR1_Exp_Date    = $_POST["R1_Exp_Date"];

and the all the date fields are not completed, the sql execution does not work


#2

What is the error message?

Error message? Incorrect / Unexpected result? Something else?


#3

Hi

This is the error message:
Could not run query: 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 ' , 0, 0, 0, 0, 0, 0, '', '', '', '', '', ' at line 114

If I complete the next set of dates, then the error moves down to the next row where the empty
dates are located.

I would like to send u the link, but don't want to do this on a public forum


#4

This is a Microsoft SQL Server forum, you may not find folk here that are familiar with MySQL.