haliphax wrote: > On Thu, Mar 5, 2009 at 4:34 PM, PJ <af.gourmet@xxxxxxxxxxxx> wrote: > >> Here we go again! >> I'm trying to do some form entry verification and am trying to figure >> out how to verify if there are 4 fields entered: >> f_nameIN, l_nameIN, f_name2IN, l_name2IN >> Verifying for each is ok, but somewhat tortured and long. I thought of >> using CONCAT_WS but it doesn't seem to listen to me. >> The manual is not very explicit as to where it can be used and by the >> examples, it would seem that it can only be used in select statements. >> Seems a little silly, no? >> Here is what I found so far. >> echo $f_nameIN," ", $l_nameIN; >> returns joe whatever - ok, fine. >> Obviously the string contains something. Right. >> Now try this >> $Author = CONCAT_WS(" ", $f_nameIN, $l_nameIN); >> echo $Author; >> and it's a flop. >> Am I missing a bracket, curly bracket or a baseball bat? >> I thought maybe I should add AS Author - but that only seems to work in >> a select statement. :'( >> Help? >> > > I believe you're mixing your T-SQL with your PHP. Sort of like getting > chocolate in your peanut butter, but not half as delicious. > > CONCAT_WS is a MySQL server-side function. It cannot be called > directly from PHP, but rather via a database call performed **by** > PHP. > > Also--PHP has the nifty "dot" (.) operator for concatenating strings. Try this: > > $Author = $f_nameIN . ' ' . $l_nameIN; > echo $Author; > > Hope this helps, > It sure does. The mud is dripping off my eyes. :-) thanks. -- unheralded genius: "A clean desk is the sign of a dull mind. " ------------------------------------------------------------- Phil Jourdan --- pj@xxxxxxxxxxxxx http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php