I am sending a serialized json string from Jquery form to a form_handler.php post. I am getting this error message on the AJAX response in firebug:
"Connected to Taskostrueresource(4) of type (mysql result)
<br />
<b>Warning</b>: [json] (php_json_encode) type is unsupported, encoded as null in <b>/Library/WebServer/Documents/form_handler.php</b> on line <b>18</b><br />
null"
The reason there are 2 results is one is to insert the data into the database and the 2nd result is to return the list as a response to the web page. So I'm assuming that the print statement would be the response to the AJAX. Do I need to do a json_decode instead? I don't know if the error is a coding issue. The doctype is <HTML5> The database encoding is utf8_genera_cil. You can see my demo page at:
http://janisrough.dyndns.biz/todo8.html
Here is my AJAX form_handler:
ini_set("max_execution_time",'800');
error_reporting(E_ALL^E_NOTICE);
include("db.php");
$task= $_POST['todo'];
$date =$_POST['date'];
$name = $_POST['name'];
$sql = "INSERT INTO task(todo, date, name) values('$task','$date','$name') ";
$result = mysql_query($sql);
if ( !$result ) {die("<font style='color:red'>Invalid query:</font>" . mysql_error() . "<br>$sql");}
$sql2="SELECT todo FROM task WHERE todo IS NOT NULL";
$result2= mysql_query($sql2);
if ( !$result2 ) {die("<font style='color:red'>Invalid query:</font>" . mysql_error() . "<br>$sql");}
var_dump($result2);
print (json_encode($result2));
echo $result2;
thanks,