This will not work. It won't insert. It won't show errors on screen (ie, too many in the array for those in the query), and if I ask it to show the last ID added, it just shows a zero. Nothing added.
Code: Select all
$query = ("INSERT INTO homepage (url, image, section, freetext, priority, content, homepromocolor, homepromotextcolor, stockbanner, dateadded) VALUES (:searchurl, :saved_filename, :section, :freetext, :priority, :content, :homepromocolor, :homepromotextcolor, :stockbanner, :todaydate)");
$result = $pdo->prepare($query);
$result->execute(array(':searchurl' => $searchurl, ':saved_filename' => $saved_filename, ':section' => $section, ':freetext' => $freetext, ':priority' => $priority, ':content' => $content, ':homepromocolor' => $homepromocolor, ':homepromotextcolor' => $homepromotextcolor, ':stockbanner' => $stockbanner, ':todaydate' => $todaydate));
If I revert back to this:
Code: Select all
mysql_query("INSERT INTO homepage (url, image, section, freetext, priority, content, homepromocolor, homepromotextcolor, stockbanner) VALUES ('$searchurl', '$saved_filename', '$section', '$freetext', '$priority', '$content', '$homepromocolor', '$homepromotextcolor', '$stockbanner')");
It works.
So what is missing or wrong in that PDO query?