Jump to content

Is_Numeric Data Error Help :)


jamjam1123

Recommended Posts

////// 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.

Link to comment
Share on other sites

You just said that it displayed what you expected. Now it's null. 

 

Again, when you get an error, you should post WHAT IT SAYS. Fortunately, it's easy to guess that it's about $_GET['cat_id']. Which means your URL does not contain a query string parameter with the index of cat_id. So, fix that.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.