Danny,
Does DateStarted have a default value or is it timestamp column. Either way, leave
DateStarted out of your column list and leave the trailing comma off the value list.
Also, even though you probably defined Zip as numeric or integer, you should probably
enclose $leaZip in quotes also in the case an empty value is rec'd (mySQL handles the
data type conversion):
INSERT INTO $db_s_leagues (leaName, leaEmail, leaOwner, Address, City,State, Zip)
VALUES('$leaName','','$leaOwner','$leaAddress','$leaCity','$leaState','$leaZip')
Randy Clamons
Systems Programming
Astro-auction.com
> ------------Original Message------------
> From: "Danny Willis" <danny.willis@stripped>
> To: <win32@stripped>
> Date: Fri, Jul-23-2004 2:34 PM
> Subject: Question about Insert Statement
>
> My question/problem I am having is that there may be cases where I do not
> have all the fields full. From my experimentation and interpretation of the
> documentation if the fields are full and I end up with a query looking like
> this:
> INSERT INTO $db_s_leagues (leaName, leaEmail, leaOwner, Address, City,
> State, Zip, DateStarted)
> VALUES('$leaName','','$leaOwner','$leaAddress','$leaCity','$leaState',$leaZi
> p,)
>
> The query fails due to the "''" and the ",)"
>
> Is there a way to work around this issue so I don't have to code up some
> funky error checking in my php code to check and adjust for any empty data?
>
> Here is the query I am working with:
>
> INSERT INTO $db_s_leagues (leaName, leaEmail, leaOwner, Address, City,
> State, Zip, DateStarted)
> VALUES('$leaName','$leaEmail','$leaOwner','$leaAddress','$leaCity','$leaStat
> e',$leaZip,$leaDateStarted)
>
> Thanks,
> Dan
>
>
> --
> MySQL Windows Mailing List
> For list archives: http://lists.mysql.com/win32
> To unsubscribe: http://lists.mysql.com/win32?unsub=1
>
>