Welcome Guest, Not a member yet? Register   Sign In
Display certain records only

I have a projects and bid table. A user bids for a project which are open and haven't expired. A project expires if current date exceeds no. of days the project is to be displayed from the day the project is posted.
For example if a project is posted on 1st July and no. of days to display the project is 5 days then on 6 July the project expires and is not displayed to users for bidding.

I have a controller project.php
function days_left_for_expiry($proj_posted_date,$job_display_days)
        echo "projectposteddate ".$proj_posted_date;
        $no_of_days="+".$job_display_days." day";
        echo "displayenddate ".date('d-m-Y',$expiry_date);
        $days_left=round($difference / 86400);
        return $days_left;

    function my_projects()
        //echo $status;
            foreach($projects as $project){
                if($project->days_left>0)// This line of code doesn't work

So in $data['projects'] I don't want to store projects which have expired. How do I do this???

Please help on this.

[eluser]Wondering Coder[/eluser]
you can just do this in a query. Read about scripting.

Expiry date is not a field in projects table. Please help me to do in CI code?

Isn't there any way to do this in CI php code?

Theme © iAndrew 2016 - Forum software by © MyBB