Search Result

Collapse
2 results in 0.0026 seconds.
Keywords
Members
Tags
escaping
  •  

  • srbakshi
    started a topic mysql_real_escape_string wrapper problem!
    in C

    mysql_real_escape_string wrapper problem!

    Hey all,
    I'm stuck with the following:

    The mysql_real_esca pe_string(conn, to, from, strlen(from)) function does not return the escaped string. So how can I go about writing a wrapper for it so that it RETURNS the 'to' string which in turn helps me fill out a query in the following manner using sprintf:

    Code:
    unescaped_query = "INSERT into MYTABLE values ('%s', '%s')";
    sprintf(escaped_query, unescaped_query,
    ...
    See more | Go to post
    Last edited by Atli; May 23 '09, 06:04 AM. Reason: Cleaned up the title.

  • When should special characers be escaped inside strings?

    Hi all. I picked up the following code example from the php manual:
    Code:
    $link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
        OR die(mysql_error());
    
    // Query
    $query = sprintf("SELECT * FROM users WHERE user='%s' AND password='%s'",
                mysql_real_escape_string($user),
                mysql_real_escape_string($password));
    My question is, shouldn't we be escaping...
    See more | Go to post
    Last edited by Atli; May 18 '09, 07:07 PM. Reason: Moved to the PHP forum, and the title cleaned up a bit.
Working...