I need some help. Goal is to get IDs for next and previous ID by "Open" Status.
- I have all records in grid listing in a status called "Open".
- When click record link and view record, I have added 2 buttons (previous and next)
- I want to be able to see the next and previous IDs in "Open" status.
- URL looks like this
localhost/my_crm/index.php/projects/view/5
- Next URL should look like
localhost/my_crm/index.php/projects/view/7
(since record view/6 is in Closed status) - Logic should follow (if project status ID is in Open status, get next ID in Open status.)
My code works, but lists previous and next sequentially (due to id+1 and id-1). Button code does not call the previous or next ID in Open status. Here's example of my next button.
Please help.
<a href="<?php if ($project_info->status->id == "open") {
echo $project_info->status->id+1;
}
?>">Next </a>
</button>
I am new to PHP and codeigniter so any help is appreciated. Mario