Hi Guys
I have been experimenting with CRUD scripts using MySqli and PHP 7 (actually I am using Maria) but I don’t think that is relevant to this question)
I am confused by default field types and the Null checkbox using PhpMyAdmin, and selecting / updating.
In my naive mind (I was brought up programming in BASIC on a 32K Commordore PET and saving my files to a cassette tape !), null empty, isset(), ‘’, ’ ', 0, 0.00, spaces are all confusing me and conflicting.
What I want seems simple to me I want to detect ‘blank’ fields in a mysql database. To clarify this I am interested in fields that look blank or = to zero numerically.
I do everything I can to ‘sanitize’ entries using trim().
I want to be able to say basically in PHP and MySQL SQL if something == ‘blank’, or WHERE something == ‘blank’, something being a $var or a column in a table. I am happy to distinguish between numeric and text fields and use different tests for each.
But simplistically I want if something == ‘blank’ to be true if the contents are nothing, an empty string, a string of spaces, any quantity of 0’s with or without decimal point or not there at all. I have tried PHP(empty) and isset() but MySQL sql does not seem to have an equivalent and = ‘’ fails if it is ’ ’ (a space)
What would be my simplest solution in defining field types, defaults etc in PhpMyAdmin and selecting ‘blank’ both by PHP and SQL. I simply want to be able to find / identify / test any fields / values that would look to a human to be blank or zero and for sort purposes be at the top of the list alphabetically / numerically. I want, in my words, fields that contain nothing, but in programming nowadays, nothing has a whole new meaning.
Thanks guys
Kerry