Tuesday, January 25, 2022

[FIXED] php - data with particular character cannot be saved to the database

Issue

please help me, I don't know how to explain the problem, I made the crud program to ensure that the problem is not in the program, the program can not store data with a particular character, for more details please see my video. thank you so so so much for your helping

https://www.youtube.com/watch?v=FN1rW8d_fIk&feature=youtu.be


Solution

I'll show you a ex. mysql_query("update categorys set cateTitle='$catename' where cateID=$id");

Now $catename is: "James" "Smith" => We have a query: mysql_query("update categorys set cateTitle='"James" "Smith"' where cateID=$id"); See that? Can not put "" in to ''

Now you must edit query like this: mysql_query("update categorys set cateTitle='/"James/" /"Smith/"' where cateID=$id");

SOLUTION: You must put "/" forward charater so use this function: mysql_escape_string($catename);



Answered By - Silver

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.