using mysql_real_escape_string()

This is a discussion on using mysql_real_escape_string() within the C++ Programming forums, part of the General Programming Boards category; Hi, I want to escape any special characters in the input field before inserting the data into mysql tables in ...

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    3

    using mysql_real_escape_string()

    Hi,
    I want to escape any special characters in the input field before inserting the data into mysql tables in C++.
    I know we can use
    Code:
    mysql_real_escape_string()
    function, however I am unsure how to use it, can anybody point me to any examples on this, or write me an example regarding what parameters this function takes and how to use this function.
    Thanks,
    Tewari

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    http://dev.mysql.com/doc/mysql/en/my...pe-string.html

    Code:
    const char *from = "What's this";
    char *to = new char[(strlen(from) * 2) + 1];
    mysql_real_escape_string(&mysql, to, from, strlen(from));

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21