This is my function:
public function update($params){ try{ $params = array(); $post_id = $_GET['id']; $stmt = $this->conn->prepare("UPDATE $this->tabname SET title= ?, post= ?, updated= ? WHERE id=$post_id "); $stmt->bindParam(1, $params[0], PDO::PARAM_STR); $stmt->bindParam(2, $params[1], PDO::PARAM_STR); $stmt->bindParam(3, $params[2], PDO::PARAM_STR); $stmt->execute(); return true; } catch(PDOException $e) { echo $e->getMessage(); } } And this is my editor.php file
<?php if(isset($_POST["submit"])){ $title = $_POST["title"]; $post = $_POST["post"]; $date = date("Ymd H:i:s"); $params = array("$title","$post","$date"); $update = new DatabaseEdit('posts'); $update->update($params); header("location: posts.php"); } ?> When I click submit , it updates on blank lines. What is the problem?
$_POST["submit"]missing.WHERE id=$post_id "PDO serves to never do that from a word - ArchDemon