You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"But the mysqli safe ?"
mysqli_real_escape_string can be circumvented, but only in very obscure situations (not likely to apply to you or most everyone else).
so never set charset with a query like this one 'SET NAMES {charset}'
Use mysqli_set_charset or mysqli_options($link, MYSQLI_SET_CHARSET_NAME, "{charset}");
There's also the issue of long term maintenance. If you use concatenated queries, even if correctly escaped, future developers are more likely to make mistakes. There's a discussion about it there: #3
i know mysql_real_escape_string is not safe
But the mysqli safe ? (improved version ).
Give me one example that will get around this ?
$id = mysqli_real_escape_string($con,htmlentities(trim($id)));
"SELECT * from table where id = '$id' "
The text was updated successfully, but these errors were encountered: