0

I have this bit of PDO that I'm trying to insert into a very simple SQL Database. The Console shows that from PHP, print_r() gives me exactly the response I'm hoping for, however - the fields are not inserting into my SQL dBase.

Please, what am I doing wrong with this?:

I have two pictures, if this will help:

Response: http://extoleducation.ipage.com/extol/test/functioning/test/pic1.png

dBase: http://extoleducation.ipage.com/extol/test/functioning/test/pic2.png

<?php
$pdo = new PDO("mysql:host=extoleducation.ipagemysql.com;dbname=trialdb","username","password");

if(isset($_POST['sample1'])) {
    $sql = "INSERT INTO `sampletable` (`sampleline1`, 'sampleline2', 'sampleline3', 'sampleline4') VALUES (:sample1, :sample2, :sample3, :sample4)";
    $query = $pdo->prepare($sql);
    $query->execute(array(':sample1'=>$_POST['sample1'],':sample2'=>$_POST['sample2'],':sample3'=>$_POST['sample3'],':sample4'=>$_POST['sample4']));
 print_r($_POST['sample1'], $_POST['sample2'], $_POST['sample3'],$_POST['sample4']);
}
MekLeN
  • 27
  • 5

1 Answers1

0

Changing the single quotes (') to backticks (`) was the solution. Thank you B_CooperA

MekLeN
  • 27
  • 5