remove php display item

Asked

Viewed 29 times

3

I have a problem here, I know it can be simple, but I still can not solve alone.

I have a slide spinning in a loop of PHP, in this slide there are "entities" that when the expiration day comes they should be removed from the slides, only of slides, I mean, they just wouldn’t show up anymore.

I’ve tried the unset() but it takes out all the products, because they all have to come from the same query.

  • Put the code you already have.

  • $fim_highlight = $product->expiration date; if( $fim_highlight == date("Y-m-d H:i:s") )ː unset($product->expiration date);

1 answer

7


Since you don’t give much detail in your question I’ll try to guess.

On a slide you have products that can only be on that slide until dd/mm/yyyy, right?

Make this logo selection in mysql:

SELECT * FROM produtos WHERE data_ativa > CURDATE();

So select only the products that are active until TODAY - kurdate() - Tomorrow will no longer be on the slide.

If my answer doesn’t help at all, please elaborate on your question.

  • Thank you Rui Costa, that’s what you said, I will try your solution and put here if it worked.

  • 1

    Rui Costa gave it right, thank you very much, your help was too, thank you very much.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.