I'm having some problems with using $_GET as a value for insert into. The connection works fine and using normal strings will result in a successful insert to the database:
$sql = 'INSERT INTO product(productplaatje, productnaam, productbeschrijving,
allergieen, productprijs, bijnaop, op)
values("hoi", "hoi","hoi","hoi","1.50",0,0 )';
This code doesnt:
$sql = 'INSERT INTO product(productplaatje, productnaam, productbeschrijving,
allergieen, productprijs, bijnaop, op)
values(' . $_GET["productimage"] . ', "hoi","hoi","hoi","1.50",0,0 )';
Error code:
Fatal error: Uncaught PDOException:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'd' in 'field list'
in C:\inetpub\Students\ADSD\2017\s1117723\addsucces.php:66
Stack trace:
#0 C:\inetpub\Students\ADSD\2017\s1117723\addsucces.php(66): PDO->exec('INSERT INTO pro...')
#1 C:\inetpub\Students\ADSD\2017\s1117723\addsucces.php(75): Connection->insertProduct()
#2 {main} thrown in C:\inetpub\Students\ADSD\2017\s1117723\addsucces.php on line 66
Can anyone explain to me why it isn't working?
Edit: Why is this marked as a duplicate of some post with double qoutations and single qouations? I looked at the post and I still don't know how to fix my problem.