Received: from www0n.netaddress.usa.net (www0n.netaddress.usa.net [204.68.24.43]) by hub.org (8.9.1/8.9.1) with SMTP id RAA22000 for ; Sun, 29 Nov 1998 17:55:03 -0500 (EST) (envelope-from ppauly@usa.net) Received: (qmail 29658 invoked by uid 60001); 29 Nov 1998 22:29:47 -0000 Message-ID: <19981129222947.29657.qmail@www0n.netaddress.usa.net> Received: from 38.14.83.151 by www.netaddress.com via web-mailer(3.1) on Sun Nov 29 22:29:47 GMT 1998 Date: 29 Nov 98 15:29:47 MST From: PETER PAULY To: pgsql-sql@postgresql.org Subject: Odd characters in inserted data... Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I'm using the "C" interface to write CGI code for a web application. I allow the user to type data into a particular field, and am storing that data into a field in a postgres database. The problem is, I have to filter the data that the user entered to remove any single quotes and other odd characters so that my SQL command doesn't get messed up. I'm building the command with printf and passing the filtered data from the user as so: update tablename set comment = '%s' where ..... And %s is substituted in the printf with the user data. If the user typed in a single quote, it would cause havoc with the sql statement. My question is, is there a better way to pass data to these commands, than to build a command string like you see above? My preference would be to pass a pointer to the data, or something like that. (same issue with insert). ____________________________________________________________________ Get free e-mail and a permanent address at http://www.netaddress.com/?N=1