Hi I am trying to make status of user so it will check how many post this user has and echo out the result, it was working fine when I was using mysql but after converting it to mysqli it giving me some errors
Here is my code:
<?php
if(!isset($_COOKIE['loggedin'])){
header("location:index.php");
}
session_start();
if(!isset($_SESSION['user'])){
header("location: index.php");
}
else {
?>
<?php
$con=mysqli_connect("localhost","root","123","user");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$resule = "SELECT count(ID) from save_data where username = '".$_SESSION['user']."'"
or die(mysql_error());
$result = $con->query($resule);
$row = $result->fetch_array(MYSQLI_NUM);
echo $row[0], $row[1];
?>
<?php }?>
Error:
Notice: Undefined offset: 1 in C:\xampp\htdocs\mysql_login\status.php on line 30