Hello, anyone has an idea of how to use php to check to see if a field in a mysql table is empty or has no values?
i tried this
$query="SELECT fieldId FROM table WHERE fieldName IS NULL" ;
but this works only if the field in the table has been set to allow nulls. the problem is, i want to check also for empty field values (e.g. zero-length strings), which is not the same as NULL.
Thanks.

try:

$query="SELECT fieldId FROM table WHERE (fieldName IS NULL) OR (''=trim(fieldName) )";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.