Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Posts
    459
    Thanks
    3
    Thanked 0 Times in 0 Posts

    // Being Added To Columns

    Hi all I have a little sign up form on my website, and when people sign up if they sign up say with a "'" in there name, when I pull the name from the database it come's in as O/'Brien... How do I get rid of this? With strip_tags?

  • #2
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    stripslashes()?

  • #3
    Regular Coder
    Join Date
    Mar 2006
    Posts
    459
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Thanks rafiki, I am working on another programmers file and trying to work out why they have done this on the insert.php page of the sign up form... Why would they want to add slashes, any ideas??

    PHP Code:
    $FirstName addslashesmb_convert_case($_SESSION['strFirstName'], MB_CASE_TITLE"UTF-8")); // Capitilize the first character for mailing list 

  • #4
    Regular Coder
    Join Date
    Mar 2006
    Posts
    459
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Actually I read about it...

    An example use of addslashes() is when you're entering data into a database. For example, to insert the name O'reilly into a database, you will need to escape it. Most databases do this with a \ which would mean O\'reilly. This would only be to get the data into the database, the extra \ will not be inserted. Having the PHP directive magic_quotes_sybase set to on will mean ' is instead escaped with another '
    So then I need to keep it how it is otherwise it won't insert into the database correct? My other page pulls the data out of the database into a .csv file and this is where I am noticing the / so is it correct to think addslashes is used when inserting data into a database and stripslashes used when pulling it out?


  •  

    Posting Permissions

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