Reputation:
when i click button send data to php script and proccess it successfully and update database but give me 500 internal server error
function like_post(i){
var id1=i;
$.ajax({url:"like.php",type:'post',data{id:id1},success:function(result){
alert("sucsses");
},error: function (request, status, error) {
alert(request+status+error);
}});
}
it,s my php script:
<?php
if(isset($_POST['id'])){
$id=$_POST['id'];
$conn=new mysqli("localhost","telegram_admin","Taher1375","telegram_db");
$likesql="UPDATE group1 SET like1=like1+1 WHERE id='".$id."'";
if (mysqli_query($conn, $likesql)) {
echo "Record updated successfully";
}
else
{
echo "failed";
}
$mysqli_close($conn);
}
?>
Upvotes: 0
Views: 23
Reputation: 190
Remove $ from mysqli_close function.
it should be
mysqli_close($conn)
Upvotes: 1