Please tell me, google, something did not find similar questions like mine. I make a small site, it implies that there will be users who will have their avatar and description in their profile. Now I think over the database, and now the question has arisen - there are two fields, respectively, of the type ava and opisanie. The user may not have them filled in (then the default avatar is put in a stub and there will be no description). So - should I leave the NOT NULL parameter in the database for the lines, or should I put NULL? How are they in this case will be fundamentally different, and in the next if the user selects an ava, for example, I can cram a link in ava using update?
1 answer
Yes, you can update. just if the field is null, then it will return null, if not null, then it will return what you set for this default field.
- That is, if you make a SELECT * tratta and look at the result, then if I did not specify anything in the ava field, then this field will be NULL. And if through an echo, for example, to output there type $ query ['ava'], then it will be written NULL? But if the value is set to NOT NULL in the database, then if the ava field is empty, then any echo will not produce anything, did I understand correctly? - DizzWebS
- it will be just empty. if not null, then some default value is usually given. - thunder
- Thank. Although I remember in another site there seemed to be no conditions for NOT NULL, and the lines were also empty. What is the difference then? Actually, that's why I asked :) - DizzWebS
- oneWell, I can’t speak for others, but for me, if not null it means THAT should be :) otherwise it is null :) - thunder
|