1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Rep Power
    I have a form (like this one im typing in now) that lets users submit info into the database. I want it to let them submit apostrophes and other characters that mysql converts, or php converts before putting them in the database. It makes it print out like /'. How can i make it just accept and apostrophe, and print it out normally.


  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Rep Power
    If you are using PHP to insert into the MySQL db, you can use the addslashes() function.

    Here is a simple example : (the submitted form fields here are "task" and "project")

    $esc_task = addslashes($task);
    $esc_project = addslashes($project);
    $sql = "INSERT INTO archives (taskname,projectname) VALUES ('$esc_task','$esc_project')";
    $result = mysql_query($sql);


    [This message has been edited by bean_bag (edited August 27, 2000).]

Similar Threads

  1. maysqladmin drop database syntax?
    By Slurm in forum MySQL Help
    Replies: 1
    Last Post: February 17th, 2004, 05:07 AM
  2. Replies: 2
    Last Post: February 11th, 2004, 03:15 PM
  3. database design and paging question
    By emilyb in forum MySQL Help
    Replies: 12
    Last Post: February 5th, 2004, 01:31 PM
  4. Database select question
    By Lobos34 in forum PHP Development
    Replies: 1
    Last Post: January 23rd, 2004, 06:49 PM
  5. Replies: 0
    Last Post: January 18th, 2004, 05:55 PM

IMN logo majestic logo threadwatch logo seochat tools logo