I want create Android application, in my application I want send comment from app to server! For server side I write this code, but when running PHP code show me this error:
The site.com page isn’t working
site.com is currently unable to handle this request.
HTTP ERROR 500
For connect to the database I write this code:
<?php
define('HOST', 'localhost');
define('USER', 'userName');
define('PASS', 'password');
define('DB', 'databseName');
$con = mysqli_connect(HOST, USER, PASS, DB);
if($con){
echo "Connection success ...";
} else {
echo "Connection Failed ...";
}
?>
When running this file (dbConnect.php) show me "Connection success ..."
.
For insert to the database I write below codes:
<?php
require "dbConnect.php";
$comment_ID = ;
$comment_post_ID = 2289;
$comment_author = "test name";
$comment_author_email = "emailTest@gmail.com";
$comment_author_url = "";
$comment_author_IP = 0;
$comment_date = 2016-09-28;
$comment_date_gmt = 2016-09-28;
$comment_content = "This is one test comment with PHP code";
$comment_karma = 0;
$comment_approved = 0;
$comment_agent = "";
$comment_type = ;
$comment_parent = 0;
$user_id = 0;
$sql_query = "INSERT INTO qpHskU_comments VALUES ('$comment_ID', '$comment_post_ID', '$comment_author', '$comment_author_email',
'$comment_author_url', '$comment_author_IP', '$comment_date', '$comment_date_gmt', '$comment_content',
'$comment_karma', '$comment_approved', '$comment_agent', '$comment_type', '$comment_parent', '$user_id');";
if(mysqli_query($con,$sql_query)){
echo "Record added successfully.";
} else {
echo "Record not added..." . mysqli_error($con);
}
?>
Insert file name is (insertComment.php), when running this file (site.com/insertComment.php) show me this error!
The site.com page isn’t working
site.com is currently unable to handle this request.
HTTP ERROR 500
How can I fix it? I am amateur in PHP!