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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2010
    Posts
    119
    Thanks
    6
    Thanked 0 Times in 0 Posts

    php cant save single quote data into the my sqltable

    hi

    i have a item code as SH-GHY'

    i need to save this item in to the table but it save as SH-GHY
    how do i save as it is in the item code

  • #2
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,341
    Thanks
    260
    Thanked 32 Times in 31 Posts
    Have you tried to sanitize that with mysql_real_escape_string before storing it to the table.

    If that does not give you the desired affect, try storing it as SH-GHY\' and in either case when you display it on the page use stripslashes to display it.

  • #3
    New Coder
    Join Date
    Sep 2011
    Posts
    80
    Thanks
    0
    Thanked 13 Times in 12 Posts
    You need to sanatise your data, look at using real-escape-string() or even better use prepared statements.

    Google SQL Injection for the reasons to use these methods.


  •  

    Posting Permissions

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