I get the above error when i run the code. Please tell me where i've gone wrong.
I'm trying to get the values and encode them with JSON and save them into the database. Then later on i'm gonna retrieve the data from the database, decode it, and send it to the client end. Following is my php code.
<?php
$name = $_POST['fname'];
$email = $_POST['email'];
$comment =$_POST['comment'];
$website = $_POST ['website'];
$rate = $_POST['rate'];
$conn = mysqli_connect("localhost","root","","webtech");
if(!$conn){
die("Connection Failed : ".mysqli_connect_error());
} else{
echo "Connection Succesful ";
}
$jsonDb = array
(
'name' => $name,
'email'=> $email,
'comment'=> $comment,
'website'=> $website,
'rate'=> $rate
);
$jsonArray = array
(
'name' => $name,
'email'=> $email,
'comment'=> $comment,
'website'=> $website,
'rate'=> $rate
);
$encodeDatabase = json_encode($jsonDb);
$encodeArray = json_encode($jsonArray);
mysql_query("INSERT INTO comments VALUES ("."'".$jsonDb['name']."'"."," ."'".$jsonDb['email']."'".","."'".$jsonDb['website']."'".","."'".$jsonDb['comment']."'".","."'".$jsonDb['rate']."'".")");
echo $encodeDatabase;
?>