php - SQL error due to ' in variable contents -


this question has answer here:

good morning,

i have issue sql insert command php. i'm trying following code:

$teammatchtable = "insert team match table                    (lineupforward) values ('$homelineupforward')";` 

however contents of $homelineupforward variable is: alexandre d'acol;

this resulting in error because of '.

what can solve problem?

you can try this.

$homelineupforward= mysql_real_escape_string($homelineupforward);  $teammatchtable = "insert team match table ('lineupforward') values ('$homelineupforward')"; 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -