php - Why is my single quotation mark (') not getting encoded? -


I have to change the code for my UITextView text encoded in NSString < / Strong> that I can include in my database with other stuff. This insertion works perfectly well, when there is a single quotation mark ... so it does not work. When I was NSLog encoded NSString , 'was not converted to anything. So when it's going to cause it to be "still have the url is to web server requests that fail ... Why not be the first to encode single quotes?

iOS:

  NSString * encodedString = (NSString *) CFBridgingRelease on my code (I'm not very good with php ) is (CFURLCreateStringByAddingPercentEscapes (zero, (CFStringRef) self.textView.text, zero, (CFStringRef) @ "* '(); [:? @ & amp; = + $, /% #]", kCFStringEncodingUTF8)); NSString * strURL = [NSString stringWithFormat: @ "http://example.org/postText.php?thePost=%@&byUserID=%@&nickname=%@", encodedString, [UniqueUserIdentification getUserID], name];  

php:

  & lt; Php $ thief = mysqli_connect ("editout", "editout", "editout", "editout"); If (mysqli_connect_errno ()) {echo "failed to connect to MySQL:". Mysqli_connect_error (); } $ ThePost = $ _GET ["The Post"]; $ Id user id = $ _GET ["BUUSERID"]; $ Nickname = $ _GET ["nickname"]; Mysqli_query ($ con, "MyTable contains VALUES ( '$ thePost', '$ byUserID', '$ name', 0, 0)"); Mysqli_close ($ thief); ? & Gt;  

Your SQL is incorrect.

  $ the post = $ _GET ["The Post"];  

Assign $ thePost with GET data, but this URL has been decoded.

For example, $ thePost " let's go !" , So its is SQL:

  Enter in the MyTable value ('go', '$ byUserID', '$ nickname', 0, 0) " 

There is clearly a syntax error.

You need to avoid the string.

And look at.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -