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 -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -