Results 1 to 4 of 4

Thread: php sql single quotes problem

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2005
    Posts
    355

    php sql single quotes problem

    Hi,

    if user pass in a single quotation value into my webpage, it will have error, how do I resolve that?

    I'm new to php and heard this issue is also relate to security issue (SQL Injection).

    Please advise

  2. #2
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: php sql single quotes problem

    Pass the user's data through the mysql_real_escape_string function.


    Has someone helped you? Then you can Rate their helpful post.

  3. #3
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: php sql single quotes problem

    Just to butt in... SQL injection is one of a few methods of exploiting a weak website, so it is very important that you follow manavos advice.

    I have been starting to research SQL injections recently, the best way to prevent them, is to learn how they work, this article provides a cool insight into how SQL injection works, and methods of preventing it in numerous languages.

    http://unixwiz.net/techtips/sql-injection.html

  4. #4
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Re: php sql single quotes problem

    Better use mysqli prepared statements
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

Posting Permissions

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



Click Here to Expand Forum to Full Width