Page 1 of 1

Tab character into text file question

Posted: Tue Jul 08, 2003 11:55 am
by JPlush76
I need to output a select statement to a text file..

my fields are supposed to be separated with tabs IE field[tab]field2[tab]field3[tab][newline]

here is how I'm doing my line

Code: Select all

<?php

$content .= $program_id."\t".$orders_id."\t".$order_date."\t\n";

?>
I throw all that data into a text field in a database table... then I select * from that table into an outfile.

When I look at the data in the database it looks great field THEN TAB field2 THEN TAB but when I look at the text file it creates its adding the slashes

field\[TAB]field2\[TAB]

any thoughts on why that could be happening?

Posted: Tue Jul 08, 2003 12:04 pm
by m@ndio
I have no clue why it's doing that... :? just run strip slashes on the string after.. but you probably knew that..

Posted: Tue Jul 08, 2003 12:05 pm
by JPlush76
well its a straight mysql command so there's no stripping slashes on the outfile command :(

Posted: Tue Jul 08, 2003 12:08 pm
by m@ndio
oh.. i see what u mean now, that's wierd :?

Posted: Tue Jul 08, 2003 12:10 pm
by m@ndio
have you tried single quotes instead of doubles?? just a thought

Posted: Tue Jul 08, 2003 12:17 pm
by JPlush76
ehhh looks like it was stupid escaping quotes around the tab character

SELECT * FROM dump INTO OUTFILE 'dump/data.file' FIELDS TERMINATED BY \"/\t\" LINES TERMINATED BY \"/\n\""

seems to work dandy now

Posted: Tue Jul 08, 2003 12:21 pm
by m@ndio
hehe :lol: