how i can to show specific record from a table |
hi guys
how are you? i have a question about, how can i show for example last 5 photo added in specific category sample: PHP Code: <?php foreach ($projects as $item): ?> this code show all records/photos on the projects, i just want to show specific category. thanks
@king_ahwaz,
This question has many answers depending on how you want it to work. Here are a few answers... - You could have the query to only pull the last 5 photos from a specific category. - You could still pull all the photos and have a filter which would allow the user to select specific photos by category Your thoughts...
(10-31-2018, 06:31 PM)king_ahwaz Wrote: could you please show my an example, i'm not an expert. What needs to be done depends completely on how the table(s) are structured. So it's really hard to provide a complete and accurate example. That being the case, I'll make some stuff up. The table "projects" has the following fields "projID" an auto incrementing integer and primary key for the table "catID" an integer representing various categories "image" the actual image data "title" a string A model function could look something like this PHP Code: public function get_last_five($category) The Query Builder documentation is HERE and everything you need to know about generating query results is HERE. |
Welcome Guest, Not a member yet? Register Sign In |