Inserting text with an Apostrophe...

admin

Administrator
Staff member
Greetings:

I have a string I need to insert from a PHP based form into a PGSql database, and this string has the potential to have an apostrophe in it, and when I try to test against something like this, I get a parse error.

My example follows:

In this example $catname is equal to Men's 2

The other two variables work just fine, but I am falling down on the apostrophe in Men's. Any ideas how to overcome this?...

My pg_exec line is below...

$result3 = pg_exec ($db,"insert into \"RaceCategories\" (\"CategoryID\",\"RaceID\",\"CatName\") values (nextval('\"CatSeq\"'),'$user_ref[0]','$catname')");

I get the following error with this line:

Warning: PostgreSQL query failed: ERROR: parser: parse error at or near "s" in /usr/local/apache/htdocs/e-rims/categories.php3 on line 83

Help... Please?... :-)

Thanks muchly in advance...
Richard W.
 
Back
Top