i have a query in my laravel 5 application that fetches some data from table. When there is data in table then it is showing data on screen, but if table has now row against query, then "readyState": 4 error is showing in console. my code looks like below.
public function some_function($accId){
$q = DB::Select("SELECT ca.*, ch.* FROM credit_accounts as ca, credit_history as ch WHERE ch.acc_id=ca.id AND ch.acc_id='$accId' ORDER BY ch.acc_id DESC");
if (count($q) > 0){
// if query fetch some data, then this if condition works fine
$val="condition true";
}
else{
// if there is no data against this query then else block not runs and return "readyState": 4 error. but it should return "condition false".
$val = "condition false";
}
return $val;
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire