I am trying to use a simple MySQL insert query with parameters in the form of an array. He continues to tell me that the number of parameters is incorrect. I tried the following, all producing the same error:
$stmt3 = $link->prepare('INSERT INTO messages VALUES(null, :room, :name, :message, :time, :color)'); $stmt3->execute(array(':room' => $Clean['room'],':name' => $Clean['name'],':message' => $Clean['message'],':time' => $time,':color:' => $Clean['color']));
and
$stmt3 = $link->prepare('INSERT INTO messages VALUES(:null, :room, :name, :message, :time, :color)'); $stmt3->execute(array(':null' => null, ':room' => $Clean['room'],':name' => $Clean['name'],':message' => $Clean['message'],':time' => $time,':color:' => $Clean['color']));
as well as declaring columns to avoid null insertion:
$stmt3 = $link->prepare('INSERT INTO messages (room, name, message, time, color) VALUES(:room, :name, :message, :time, :color)'); $stmt3->execute(array(':room' => $Clean['room'],':name' => $Clean['name'],':message' => $Clean['message'],':time' => $time,':color:' => $Clean['color']));
This is my first time using PDO (I usually use mysqli, but my current shared host does not have the mysqlnd plugin, preventing me from using prepare (), so any insight is appreciated from this point of view.