////// Your Database Details here /////////
require "z_db.php"; //Your database details here
//////////////////////////// Main Code sarts ///////////////
@$cat_id=$_GET['cat_id'];
//$cat_id=1;
if(!is_numeric($cat_id)){
echo "Data Error "; <----- I'm getting the "data error" message and I'm wondering what the cause is.
exit;
}
$message="";
if($cat_id>0){
$q=mysql_query("select subcat_id, subcat_name from plus2_subcat where cat_id=$cat_id order by subcat_name");
}else{
$q=mysql_query("select subcat_id, subcat_name from plus2_subcat order by subcat_name ");
$cat_id=0;
}
@$message .= mysql_error();
$str= "{ \"data\" : [ ";
while($nt=mysql_fetch_array($q)){
$str=$str."{\"subcat_id\" : \"$nt[subcat_id]\", \"subcat_name\" : \"$nt[subcat_name]\"},";
//$str=$str."{"myclass" : "$nt[class]"},";
}
$str=substr($str,0,(strLen($str)-1));
$message=$message. " Records displayed";
$str=$str."],\"value\" : [{\"cat_id\" : $cat_id,\"message\" : \"$message\"}]}";
//echo json_encode($str);
echo $str;
?>
This is script I'm trying to edit and it came with a mysql dump so the database is working and is fetch some data but I'm getting this error in one of the drop down menus.