How to update a specific data of a table?
I am making a likes/dislikes thing in php & html. So, since it uses likes
for each blog, I use the blog ID. I would like to know how I could update
the "likes" in the table, but only update the "likes" of the specific row
using it's id. Here is the php script:
<?php
require 'init.php';
$rating = $_GET['rating'];
$postid = $_GET['id'];
if ($rating = "like"){
$sql = "
";
}
if ($rating = "dislike"){
$sql = "UPDATE
posts
SET
dislikes = dislikes+1
WHERE
id = $postid
";
}
?>
No comments:
Post a Comment