When running UPDATE
the following errors occurred:
Notice: Undefined variable: mysqli in C:\xampp\htdocs\guaraparivirtual\count\count.php on line 17
Fatal error: Uncaught Error: Call to a member function query() on null in C:\xampp\htdocs\guaraparivirtual\count\count.php:17 Stack trace: #0 {main} thrown in C:\xampp\htdocs\guaraparivirtual\count\count.php on line 17
Code:
<?php include ("../incluir/conexao.php"); ?>
<?php
$id = $_GET["id"];
$propaganda_count=mysqli_query($con,"select click,link FROM bannersclick where id='$id'");
while($count_click=mysqli_fetch_array($propaganda_count)){
$clickget = $count_click['click'];
$linkget = $count_click['link'];
}
$clickget = $clickget + 1;
$sqli = "UPDATE bannersclick SET click = '$clickget' where id = '$id'";
$mysqli->query($sqli);
header( "Location: $linkget" , TRUE , 302 );
?>
Line 17 of the errors is: $mysqli->query($sqli);
I tried to solve it, but I did not understand the reason for the error.