Re: DB question: efficient way to smartQuote() a list of fields before INSERT statement?

From: Date: Fri, 07 Jan 2005 21:52:53 +0000
Subject: Re: DB question: efficient way to smartQuote() a list of fields before INSERT statement?
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16809@lists.php.net to get a copy of this message
perfect - thanks! I use prepare now! Justin Patrin <papercrane@gmail.com> wrote:On Fri, 7 Jan 2005 12:57:11 -0800 (PST), l Burnerheimerton wrote: > > I need to INSERTs lots of fields into a table and need to smartQuote() them all. Is there an > efficient way to do this? I have thought about the function below but wonder if there's a way > to quote lots of fields at once before insertion? > > Can you do a mass INSERT using DataObject? > > function smartQt ($fld) { > $quotedFLD = DB->smartQuote($fld); > } > > Thanks for any ideas. > Why would you want to write your own function which just called quoteSmart? In addition DB is not a var and won't be define din that function. Just call it inline: $sql = 'INSERT INTO TABLE (...) VALUES ('.$db->quoteSmart($value).', ...)'; There is also prepare() which does auto-quoting on the values. (Then you need to execute()). There's also autoPrepare and autoExecute which will create the whole INSERT for you. -- Justin Patrin -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --------------------------------- Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone.

« previous php.pear.general (#16809) next »