Update data in database with pdo?

I recently made a CMS with mySQL and PDO following a video tutorial from PHPAcademy on youtube.

I want to add an edit function to it though.

I have the page done, but not the PHP to update the data.

So, I'm wondering, how would I update data in the database with PDO and save the new data?

I have this:

$query = $pdo->prepare("UPDATE articles 'article_content'=? WHERE 'id' = ?");
$query->bindValue(1, $_POST['content']);
$query->bindValue(2, $_POST['id']);



You have 2 issues:

"UPDATE articles SET  `article_content`=? WHERE `id` = ?"

One you are missing SET.

Two you are using single quotes for column names;use backticks

You are missing the keyword SET in your query

It should be

$pdo->prepare("UPDATE articles SET `article_content`=? WHERE `id` = ?");

Need Your Help

Sum up distances of a permutation list (Haskell)

haskell haskell-mode

I have a list of Towns and a function, which gives out the distance between two of them. For example: