• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
display date

#1
[eluser]diasansley[/eluser]
i am facing the following problems

* I have designed coupons on the front page with a from date and a to date.
*the coupons table has a from field and a to field. now by default it prints from 0000-00-00 00:00:00 to 0000-00-00 00:00:00
now my problem is if a change the to date in the database and refresh the page the coupon doesnt show.

ill paste the model code here
Code:
function getCouponsToFrontpage($count)
    {
        $result = $this->db->query('SELECT coupon_to_frontpage.coupon_id as coupon_id,
                                    coupon_to_frontpage.updated_at as updated_at,
                                    coupons.entry_id,coupons.name,coupons.text,coupons.image_path,
                                    coupons.image_rights,coupons.image_description,coupons.from,
                                    coupons.to , coupons.from, coupons.to, coupons.published,
                                    coupons.canceled, coupons.updated_at as coupon_updated,date_format(coupons.from,"%d.%m.") as formated_date_from,date_format(coupons.to,"%d.%m.%Y") as formated_date_to
                                    FROM '.$this->table.'
                                    LEFT JOIN coupons  ON  '.$this->table.'.coupon_id = coupons.id
                                    WHERE coupons.published = 1
                                    AND ((date_format(current_date,"%d-%m-%Y")
                                    BETWEEN date_format(coupons.from,"%d-%m-%Y")
                                    AND date_format(coupons.to,"%d-%m-%Y"))
                                    OR date_format(coupons.to,"%d-%m-%Y") = "00-00-0000")
                                    ORDER BY coupons.from desc
                                    LIMIT '.$count);
        $result = $result->result_array();
        return $result;
    }
}




thanks

#2
[eluser]InsiteFX[/eluser]
You need to show more code!

How our you refreshing the page etc.

Controller code.
View code.

InsiteFX

#3
[eluser]diasansley[/eluser]
refreshing is a normal page refresh.. no code as such but when i change the data in the database the coupon is not displayed.

Thanks


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.