I get this error, I tried going through other similar threads but it didn't help.
here is php
$host = "http://www.domain.com";
$hostname = "localhost";
$username = "aaa";
$password = "sss";
$userstable = "ddd";
$dbName = "fff";
if ($url != $host){
$con = mysqli_connect($hostname, $username, $password, $dbName);
//@mysqli_select_db("$dbName");
// Check connection
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$query = mysqli_fetch_row(mysqli_query($con, "SELECT * FROM $userstable where(url = '$url')"));
if ($query == false){
$hits = "1";
$query2 = "INSERT INTO $userstable (url,hits) VALUES('$url','$hits')";
}
else {
$hitquery = "SELECT `hits` FROM $userstable where url = '$url'";
$result = mysqli_query($con, $hitquery);
$hits = mysqli_fetch_assoc($result, 0, 'hits');
//$hits = mysqli_result(mysqli_query("SELECT `hits` FROM $userstable where url = '$url'"), 0, "hits");
$query2 = "UPDATE $userstable SET `hits` = hits+1 where url = '$url'";
}
mysqli_query($con, $query2);
}
if(!$url) {
$url = "$host";
}
eror generate on line 157
$hits = mysqli_fetch_assoc($result, 0, 'hits');
How to fix this mysqli ?
please you're help.