[snip] What I don't understand is the syntax of this line: $row_count = is_array($row) ? count($row) : 0; [/snip] This is a ternary comparison form of an IF statement...read it like this... if(is_array($row)){ //this is the ? count($row); } else { //this is the : 0; } http://us3.php.net/ternary about 1/3rd down the page.