#1
  1. No Profile Picture
    Raistlin
    Guest
    Devshed Newbie (0 - 499 posts)
    When I enter text into a form with an apostrophe and submit it. I then attempt to enter it into a database via a query. I receive an error about unclosed quotes. So I checked the variable and slashes are being put in front of all apostrophe's. I have tries addslashes and stripslashes with no luck.I am working with MSSQL not MYSQL.

    [This message has been edited by Raistlin (edited 08-31-99).]
  2. #2
  3. No Profile Picture
    moderator
    Guest
    Devshed Newbie (0 - 499 posts)
    addslashes() should be the function you need.

    Make sure you are using

    $var = addslashes($var);

    not

    addslashes($var);
  4. #3
  5. No Profile Picture
    horaR
    Guest
    Devshed Newbie (0 - 499 posts)
    Maybe the slash is not working for M$SQL.
    Try adding a second apostrophe to each one:

    $name = str_replace("'", "''", $name);
    eg:
    if name = "D'ALMASSO", it works "D''ALMASSO" to query the database.


Similar Threads

  1. Replies: 5
    Last Post: February 2nd, 2005, 01:28 AM
  2. UTF-8 problem in 4.1.1a
    By mehran20 in forum MySQL Help
    Replies: 1
    Last Post: February 8th, 2004, 03:21 PM
  3. WinNT4 problem
    By sandipguha in forum Windows Help
    Replies: 0
    Last Post: January 27th, 2004, 03:06 AM
  4. weird java problem..please help
    By suwandy in forum Java Help
    Replies: 1
    Last Post: January 26th, 2004, 05:13 AM
  5. Session Variable problem :(
    By modesty in forum PHP Development
    Replies: 1
    Last Post: January 15th, 2004, 05:00 AM

IMN logo majestic logo threadwatch logo seochat tools logo