FlyingMachine Posted April 15, 2015 Report Share Posted April 15, 2015 Hey after some modifying onto Schedules_results.tpl in html i got this error if the the search done without results Warning: Invalid argument supplied for foreach() in /home/xxxxx/public_html/xxxxxx/core/templates/schedule_results.tpl on line 136 in case the search with results everything work ok regards Quote Link to comment Share on other sites More sharing options...
FlyingMachine Posted April 22, 2015 Author Report Share Posted April 22, 2015 any answer ? Quote Link to comment Share on other sites More sharing options...
Sava Posted April 22, 2015 Report Share Posted April 22, 2015 Well, I don't see what the issue is. foreach(), as the name says, does the same action for each of the objects in the array. If the search is without results, it won't have anything to go over and will give you an error saying that what you have supplied as an argument to the function is invalid (empty in this case). What you can do is something like this. <?php if($flights_variable) { foreach($flights_variabls as $flight) { //do stuff } } else { echo 'There are no flights for your search criteria'; } You get the overall idea I hope. And also, as there have been a lot of posts lately similar to yours, Google is your friend, and errors in PHP are usually pretty straight forward. It would have taken you less time to find and answer using Google then it would have taken for me or someone else to reply. And, you would have learned something new along the way. Just a friendly tip. Sava Quote Link to comment Share on other sites More sharing options...
FlyingMachine Posted April 23, 2015 Author Report Share Posted April 23, 2015 thanks ! already checked my dear google nothing was happened the same Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.