Cannot insert data into database

Hi guys,

I’ve checked this for hours and can’t see anything wrong, but why I cannot insert data into my database.

        $sql = "
		INSERT INTO topics(
			uid, dates, title, content, tag
		)
		VALUES(
			:id, :date, :title, :content, :tag
		)
	";
	try {
		$statement = $conn->prepare($sql);
		$statement->execute(array(
			":id" => $id,
			":date" => $date,
			":title" => $title,
			":content" => $content,
			":tag" => $tag
		));
		header("location: index.php");
	} catch(PDOException $e) {
		echo $e->getMessage();
	}

All the variables are not null but it goes to the index.php without doing anything.

Thanks

Never mind, I can solve this

For the sake of other readers, what was your solution?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.