I have this: $description = $file['description']; PHP: The description is set on gamepages, but not pages without games. So, I would need something that says if the description is empty, then the description is "no description" So I guess I would need to use IF and whatever, like, if $description = empty; set the $description = "description was empty"; if you get me?
$description = $file['description']; if($description == ''){ $description = "description was empty"; } PHP:
This is a handy function from osCommerc: function tep_not_null($value) { if (is_array($value)) { if (sizeof($value) > 0) { return true; } else { return false; } } else { if (($value != '') && (strtolower($value) != 'null') && (strlen(trim($value)) > 0)) { return true; } else { return false; } } } PHP: In your case: if(!tep_not_null($description){ //Note the ! $description = 'no description'; } PHP: Unlike jestep's suggestion this allows for null, spaces, false etc.
TOPS30, Try this function instead: function notNull($value) { switch(gettype($value)){ case 'boolean': case 'object': case 'resource': case 'integer': case 'double': return true; break; case 'string': if (($value != '') && (strtolower($value) != 'null') && (strlen(trim($value)) > 0)){ return true; } else { return false; } break; case 'array': if (sizeof($value) > 0){ return true; } else { return false; } break; case 'NULL': default: return false; break; } # end switch } # end function PHP: Bobby
There's always one geek being a smart ass Needless to say El Bobbo's code is far superior to anything that has HpdL towards the top