mardi 26 juin 2018

else statement not working for the following php code

I have this doctors schedule with dates and returning only those dates that are greater than today.But when there are dates that are previous to today,for which i am unable to return 'No dates available'. Here is my code:

$lists =  Gateway::Onlineschedule()->schedulelist($inputs['doctor_id']);
        $today=date("d/M/Y");

        if(count($lists) == 0)
            {
                return 'No entry detected';

            }
            else
            {
                foreach ($lists as $list) 
                {

                    $api_procedure['Day'] = $list->day; 

                    if($api_procedure['Day']>$today)
                    {
                        $listing[] = $api_procedure;
                    }
                    else
                    {
                        return 'No dates available';
                    }
                }

                return json_encode($listing);

            }

what should i change to get my desired output. This is in laravel framework.Thanks.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2tERCei
via IFTTT

Aucun commentaire:

Enregistrer un commentaire