Forum Moderators: coopster

Message Too Old, No Replies

optmizing mysql - php NULL fields

         

helenp

10:59 pm on Oct 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi I just done my first database using mysql - php and have some questions about optimizing, using forms to insert and update tables.

First, when I insert dates into sql tables using an form, sometimes there are fields left in blank, result, there is no NULL value as should be, though I Insert all fields at once.
I read empty fields are bad.

Second,
In one table I have columns decimal (10,2),
when this table is updated to insert the imports using an form, happens similar, when leaving one field in blank mysql automatically fill 0.00 in, I would prefer just leave it as NULL.

Though I donīt have any experience, just would like to know how you do these things.

coopster

9:16 pm on Oct 29, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Blank and NULL are two very different values and often create confusion [dev.mysql.com]. You could always check the incoming fields for empty [php.net] values or even determine if the form value has even been set using the isset() [php.net] function.