maybe $photographer doesn't have a value? Put an ns_log Notice "photographer=$photographer" just after your db_0or1row. It could be the XQL file isn't picking up your changes to the SQL query.
Brian