I have written a mysql query which selects some rows from a table depending on a condition and writes it to a txt file. But i realized, its inserting a set of additional characters 
in the last line of the file. Here is the query
$sQuery = " ( ";
$sQuery .= " SELECT number ";
$sQuery .= " INTO OUTFILE '".$outputfile_ndnd."' ";
$sQuery .= " FIELDS TERMINATED BY ',' ";
$sQuery .= " LINES TERMINATED BY '\r\n' ";
$sQuery .= " FROM `".$database."`.$temp_table_name";
$sQuery .= " WHERE number NOT IN (SELECT number FROM `dnd`.`dnd` )";
$sQuery .= ")";
Any suggestion to stop that from inserting in to file? (I saw the other similar questions asked, they say its UTF-8's BOM
, but didnt get how to stop it in my case of mysql query)