Trying to insert a single row into my table. Having a mare, tried to use tens of examples on the tinterweb
to no success, I must just not understand how PDO works yet.
$stmt = $dbh->prepare ("INSERT INTO table_name (date, link, desc)
VALUES (:date,:name,:desc)");
$stmt -> bindParam(':date', $date);
$stmt -> bindParam(':name', $name);
$stmt -> bindParam(':desc', $desc);
$stmt -> execute();
move_uploaded_file($_FILES["file"]["tmp_name"], $upload);
desc
is a reserved word and have to be formatted.So, the code have to be
$stm = $dbh->prepare("INSERT INTO table (date,link,`desc`,type) VALUES (?,?,?,?)");
$stm->execute(array($date,$name,$desc,$type));
move_uploaded_file($_FILES["file"]["tmp_name"], $upload);