This is my android json response for php mysql
data insert application. please help me to get the original json from this return response
or how to skip return web (HTML) table from return response
(data success fully inserting to the data base table
)
<br />
<font size='1'><table class='xdebug-error xe-deprecated' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\wamp\www\AndroidFileUpload\db_connect.php on line <i>28</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0010</td><td bgcolor='#eeeeec' align='right'>252784</td><td bgcolor='#eeeeec'>{main}( )</td><td title='C:\wamp\www\AndroidFileUpload\upload_news.php' bgcolor='#eeeeec'>..\upload_news.php<b>:</b>0</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.0020</td><td bgcolor='#eeeeec' align='right'>263888</td><td bgcolor='#eeeeec'>DB_CONNECT->__construct( )</td><td title='C:\wamp\www\AndroidFileUpload\upload_news.php' bgcolor='#eeeeec'>..\upload_news.php<b>:</b>26</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>3</td><td bgcolor='#eeeeec' align='center'>0.0020</td><td bgcolor='#eeeeec' align='right'>263976</td><td bgcolor='#eeeeec'>DB_CONNECT->connect( )</td><td title='C:\wamp\www\AndroidFileUpload\db_connect.php' bgcolor='#eeeeec'>..\db_connect.php<b>:</b>11</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>4</td><td bgcolor='#eeeeec' align='center'>0.0020</td><td bgcolor='#eeeeec' align='right'>264792</td><td bgcolor='#eeeeec'><a href='http://www.php.net/function.mysql-connect' target='_new'>mysql_connect</a>
( )</td><td title='C:\wamp\www\AndroidFileUpload\db_connect.php' bgcolor='#eeeeec'>..\db_connect.php<b>:</b>28</td></tr>
</table></font>
{"success":1,"message":"Product successfully created."}
at the last line of the response have needed json result. any help appreciate. thanks in advance.
here is my php
code
<?php
// array for JSON response
$response = array();
// check for required fields
if (isset($_POST['news_Title']) && isset($_POST['news_Details']) && isset($_POST['news_Image'])&& isset($_POST['news_Video']) && isset($_POST['reporter_Name']) && isset($_POST['reporter_Email']) && isset($_POST['reporter_Phone'])) {
$news_Title = $_POST['news_Title'];
$news_Details = $_POST['news_Details'];
$news_Image = $_POST['news_Image'];
$news_Video = $_POST['news_Video'];
$reporter_Name = $_POST['reporter_Name'];
$reporter_Email = $_POST['reporter_Email'];
$reporter_Phone = $_POST['reporter_Phone'];
// include db connect class
require_once __DIR__ . '/db_connect.php';
// connecting to db
$db = new DB_CONNECT();
// mysql inserting a new row
$result = mysql_query("INSERT INTO news(news_Title, news_Details, news_Image, news_Video, reporter_Name, reporter_Email , reporter_Phone) VALUES('$news_Title', '$news_Details', '$news_Image', '$news_Video', '$reporter_Name', '$reporter_Email', '$reporter_Phone')");
// check if row inserted or not
if ($result) {
// successfully inserted into database
$response["success"] = 1;
$response["message"] = "Product successfully created.";
// echoing JSON response
echo json_encode($response);
} else {
// failed to insert row
$response["success"] = 0;
$response["message"] = "Oops! An error occurred.";
// echoing JSON response
echo json_encode($response);
}
} else {
// required field is missing
$response["success"] = 0;
$response["message"] = "Required field(s) is missing";
// echoing JSON response
echo json_encode($response);
}
?>