problem when doing update php data and show

Asked

Viewed 44 times

-1

i have a page where I can add and change data in the BD using the update.

Now I have a problem because when I update a page all the dates I ask for go from null to 0000-00-00. and me using this code:

if(!empty($exibe["MedicaValidade16"])) {

he’s gonna show me all the data they got for getting 0000-00-00 . The way around this?

  • 1

    I didn’t understand the problem

  • Try to rephrase your question and post the codes you use to try to help you. Your question is unclear...

1 answer

0

This, in my view, is being recorded in the bank in the same way 0000-00-00 and not null, maybe your table field is like not null so recorded in this format.

Of two 1, either you change your table if that’s the case, or test the return on your application like this:

if(!empty($exibe["MedicaValidade16"]) || $exibe["MedicaValidade16"] != '0000-00-00') {

I hope I’ve helped!

  • Medicavalidade has only deafault NULL

  • How are the Medicavalidade records in this table when there is no date? null or 0000-00-00?

  • null. After using update, 0000-00-00 appears or blank

  • hmm.. And he’s this field on update CURRENT_TIMESTAMP?

  • This way it is not working properly. Dates 0000-00-00 continue to appear

  • Corrected by amending || by &&

Show 1 more comment

Browser other questions tagged

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