thank you for your help eval
but now i am converting the obsolete mysql to mysqli (which is such a pain to me), so i guess the php code would be like?
<PHP>
$resource=$connection->query(sprintf(
"SELECT *,
IFNULL(column1,column2) AS finalcolumn
FROM mytable
WHERE IFNULL(column1,column2)='%s'",
mysqli_real_escape_string($link, $visitor_criteria)));
</PHP>
ps: i use if "IFNULL" because i want the criteria to be: if column1 is not null then use column1, otherwise use column2, which always contain a value
also, is there any websites that i can learn mysqli command? i found that php.net is sometimes intimidating 