the concat_ws command is mysql only works in a sql statement.

if you want to do this in code then

PO_Date= $_POST['PO_Year'].'-'.$_POST['PO_Month'].'-'.$_POST['PO_Day'])';

will work


Subject: RE: [PHP-DB] Concat 3 fields in a query
Date: Fri, 3 Dec 2004 13:21:50 -0500

Thanks to all that responded to this thread I learned from it.

I actually validate the data before it even gets to the insert or update
statment to make sure there are no evil characters out there trying to
cause me pain.

I do have one more question I fixed the insert query now onto the update
query where the syntax is a little different so from your example I should
be able to do this then correct?

PO_Date= '"

or would I not need the ' around all of them.  Any good sites out there to
explain when to use ' and when to use "  sorry kind of a newbie but
appreicate all of the help maybe one day I can return the favor.


"Norland, Martin" <[EMAIL PROTECTED]>
12/03/2004 12:03 PM
Please respond to


RE: [PHP-DB] Concat 3 fields in a query

-----Original Message----- From: Bastien Koert [mailto:[EMAIL PROTECTED] > concat_ws('-',{$_POST['PO_Year']},{$_POST['PO_Month']},{$_POST['PO_Day'] })

I'm pretty sure this will error because of the unneccessary {}'s around
the POST array items.  PHP really doesn't like you using extra curlies
around variables, it's very picky.


Not trying to be anal, I've just been bitten many a time as I do lots of
dynamic class and variable coding, and ritualistically try to thunk
curlies around most everything.

> ps. I strongly recommend validating data before you insert into the db

I couldn't agree more.


- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.

PHP Database Mailing List (
To unsubscribe, visit:

-- PHP Database Mailing List ( To unsubscribe, visit:

Reply via email to