Please add:

    res = mysql_store_result(conn);

in this line, it seems like it is missed.