$str="james//bond";
$str= mysqli_real_escape_string($con,$str);
//insert query
after successful insert in database it value shows as "james/bond"
how I can insert exact string
$str="james//bond";
$str= mysqli_real_escape_string($con,$str);
//insert query
after successful insert in database it value shows as "james/bond"
how I can insert exact string
Try this
$str = "james////bond
@Devi_3
When you write:
after successful insert in database it value shows as "james/bond"
You intend this is how the input is actually saved in the database or how is it returned by the retrieving script?
Also: could you show the insert query? The escaping function shouldn't change the slashes.
Provided that your insert query is
"INSERT INTO `users` (`username`) VALUES ({$str})"
Make this just a literal by putting the variable $str
into single quotation marks. So use
"INSERT INTO `users` (`username`) VALUES ('{$str}')"
I hope this solves your problem, or if not show your insert and select queries
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.