show posts belong to any category in php
i am just start coding with my PHP, i have to know about populate (fetch) content from database anyway so you no need to worry about this section :)
today when i am trying to implement my new web task that my use can select any post category and i have to done with this task but there is one thing getting wrong :(
first of all, here is sample of my URL to get list of post based on category that my user clicked:
so this URL would fetch all content (post title, post author, post content, cat label, etc) but when i enter non exist cat id it will show show error like invalid argument supplied for foreach.
what should i do when my user want to get non exists cat_id without any php error instead show a 404 page error :x