num_rows(), ## "Found only one matching record", ## "Found %s records"); ## Will output if num_rows() is 1: "Found only one matching record" ## 200: "Found 200 records" ## ## if $val is empty() or "" a blank string will be returned! ## function o_1or2 ($val,$str1,$str2) { if (isset($val) && $val) { if (1==$val) { return(sprintf($str1,$val)); } else { return(sprintf($str2,$val)); } } else { return(false); } } function p_1or2 ($val,$str1,$str2) { print o_1or2 ($val,$str1,$str2); } ## ## This is for the case, that you want to output something ## if $val is false e.g. ## ## p_0or1($faxnumber,"THERE IS NO FAXNUMBER","Faxnumber: %s"); ## function o_0or1 ($val,$str1,$str2) { if (empty($val) || !$val) { if (isset($val)) { return(sprintf($str1,$val)); } else { return($str1); } } else { return(sprintf($str2,$val)); } } function p_0or1 ($val,$str1,$str2) { print o_0or1 ($val,$str1,$str2); } ## ## Replaces all blank-chars with   ## This function is used, when you are not willing to let the browser ## break your lines an can be used instead of -Tag ## as very compatible replacement ## ##   can also be replaced by a true whitespace which has in ## ISO-latin-1 the code 160 ## function o_nonbsp ($val) { return(ereg_replace("[[:blank:]\n\r]"," ",$val)); } function p_nonbsp ($val) { print o_nonbsp($val); } ?>