I am new to PHP & JSON, and based on a tutorial I made a simple web service which returns the contents of a table of a mysql db.
The output is in JSON and the database caracter set is UTF-8. my problem is that when I try to run this it throws me a 404 error, and doesn't show me where the error is. Any idea what might be wrong?
The PHP file is the following:
<?php
ini_set("display_errors", 1);
error_reporting(E_ALL);
$link = mysql_connect($mysql_host,$mysql_user,$mysql_password) or die("cannot connect to the DB");
mysql_select_db($mysql_database,$link);
$query = "select...";
$result=mysql_query($query) or die (mysql_error("error "));
$num=mysql_numrows($result);
$rows=array();
while($r=mysql_fetch_assoc($result)){
$rows[]=$r;
}
echo json_encode($rows);
?>
Any Idea? Thanks in advance