Saving " in a Pervasive SQL database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bailiss
    New Member
    • Jan 2009
    • 2

    Saving " in a Pervasive SQL database

    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...
    [code=php]
    if($_POST["uom"] == 'feet')
    {
    $height = $_POST["height"] . "\"'"\";
    }
    else
    {
    $height = $_POST["height"] . "\"""\"
    }
    [/code]
    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,g roundcolor,eros ion_control,cut _flower,wet,dry ,boddy,fragrant ,key_benefits,g rowth) 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!
    Last edited by pbmods; Jan 13 '09, 12:35 AM. Reason: Added CODE tags.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    are these signs the single and double quotation marks? maybe it helps to replace them by the unicode signs. foot: U+2032 (&#38;#8242;) , inch: U+2033 (&#38;#8243;)

    Comment

    Working...