I have query like below
function getConnected($host,$user,$pass,$db) {
$mysqli = new mysqli($host, $user, $pass, $db);
if($mysqli->connect_error)
die('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
return $mysqli;
}
$sqli= getConnected('localhost','db','pass','user');
if ($data = $sqli->query("INSERT INTO `buy_diet`.`rcat` (`cat`, `id`) VALUES ('$cat', '$idea');")) {
echo $data;
}
else
{
echo "fail";
}
above code always failing..database is connected and all other queries like select , update etc are working fine , But INSERT query is failing...I have tried to copy the exact statement and run the query in phpmyadmin ,its working but not in above php code.
So how can I debug whats the problem.Right now I get only this error (bool)false , How to see detailed error.