Results 1 to 2 of 2
  1. #1

    Lightbulb mysql and php form error

    Hey guys - I have a php form that submits to a mysql database and there's one last bug - when someone uses the "\" character it errors out. How do I make it treat "\" as part of the string without interrupting the statement or how do I strip the \ from the input:

    example code:
    $sql = "INSERT INTO affiliates SET " .
    "pridomain='$pridomain', " .
    "uname='$uname', " .
    "upwd='$upwd', " .

    error when \ is used:
    Error adding your registration entry: You have an error in your SQL syntax near '\'
    _________________
    The Unknown Host
    I Gotta Get A NOC

  2. #2
    To protect the slashes use the function addslashes()

    To remove the slashes alltogether use the function stripslashes()

    See :

    http://www.php.net/manual/en/function.addslashes.php

    and

    http://www.php.net/manual/en/function.stripslashes.php

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •