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

From: Date: Fri, 03 Dec 2004 17:03:20 +0000
Subject: RE: [PHP-DB] Concat 3 fields in a query
Groups: php.db 
Request: Send a blank email to php-db+get-37560@lists.php.net to get a copy of this message
-----Original Message----- From: Bastien Koert [mailto:bastien_k@hotmail.com] > 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. Instead: concat_ws('-',$_POST['PO_Year'],$_POST['PO_Month'],$_POST['PO_Day']) 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. Cheers, - 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.

« previous php.db (#37560) next »