I'm trying to add a row to my table video_games
by using the value of a $_GET
like this:
$yourname = $_GET['yourName'];
$bdd->exec('INSERT INTO video_games(name, owner, console, price) VALUES($yourname, \'Patrick\', \'PC\',45)');
But I get this error:
Unknown column
$yourname
infield list
I tried several other solutions like $name
or name
or 'name'
instead of $name
. But I can't have the value of $_GET
to be inserted.
I have also checked other posts and I did not find any solution, yet it should be a famous question.
To make it simple, the problem is: How to put the value of a variable in an INSERT
statement using the exec()
function ?
Thanks.