By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,078 Members | 2,159 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,078 IT Pros & Developers. It's quick & easy.

Saving " in a Pervasive SQL database

P: 2
I am trying to save the " (inch mark) and ' (foot mark) into a database. I am not using MySQL regrettably. Instead, I have to use a Pervasive SQL database, version 8.5.

The user is supposed to enter the height a plant normally grows to. An acceptable answer may be 6'. I have a textbox for the number and use JavaScript to verify it is a number. That works fine. I have two radio buttons that ask Inches or Feet because some people do not know the difference.

The height is saved as $_POST["height"] while the unit of measurement is $_POST["uom"].

To see what option the user chose, I use a basic if statement...
Expand|Select|Wrap|Line Numbers
  1. if($_POST["uom"] == 'feet')
  2. {
  3.     $height = $_POST["height"] . "\"'"\";
  4. }
  5. else
  6. {
  7.     $height = $_POST["height"] . "\"""\"
  8. }
I am getting an SQL error when inserting this into my table:

Warning: SQL error: [unixODBC][Pervasive][Pervasive ODBC Client Interface][Pervasive][ODBC Engine Interface]Syntax Error: ion, border,accent,groundcolor,erosion_control,cut_flow er,wet,dry,boddy,fragrant,key_benefits,growth) VALUES( 'shade', 's', 's', 'd', '', '', '', '', '', '', '', '', 1, 0, 0, 1, '', 5\<< ??? , SQL state 37000 in SQLExecDirect in /var/www/html/plantbase/new_entry.php on line 578

I know the problem is with the "\"""\" portion because I have tested this every which way and it all works until I try inserting the " or ' symbol. Any ideas on how to get this to work?

Thanks very much!
Jan 12 '09 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 8,639
are these signs the single and double quotation marks? maybe it helps to replace them by the unicode signs. foot: U+2032 (&#8242;), inch: U+2033 (&#8243;)
Jan 13 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.