Hello i want to make a statement that increases a row on a table on MySql every time one visits the page. The $_GET['ID'] its ok dont waste your time with that.
This is the statement
require 'config.php';
$db = getDB();
$ID=$_GET['ID'] ;
mysqli_query($db, "UPDATE table SET count = count + 1 WHERE id=".$ID)or die(mysqli_error($db));
and on the config.php i have this to connect with db
function getDB()
{
$dbhost=DB_SERVER;
$dbuser=DB_USERNAME;
$dbpass=DB_PASSWORD;
$dbname=DB_DATABASE;
$dbConnection = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass); //Other database change PDO configuration
$dbConnection->exec("set names utf8");
$dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return $dbConnection;
}
My Current PHP version: 5.3