I've created a new function with PDO to insert data in my database.
The function looks like this
function insert($table,$column = array(),$value = array()) { $array1 = implode(",", $column); $array2 = implode(",", $value); try { $sql = $this->connect->query("INSERT INTO $table ($array1) VALUES ($array2)"); } catch(PDOException $e) { echo $e->getMessage(); } } and the call for the function like this
-> insert('coupons',array('categorie','name','link','code','id'),array('test11','test','test','test','NULL')); but after all, it seems not to work and isn't showing any error. Do someone have a few points for me, where I should search the mistake? When I write the query /wo the varibales and call the function, it works. Even with the first two variables it works. Only the last one ($array2) seems to have a "bug".
bindParam()