iPixel Posted March 18, 2008 Share Posted March 18, 2008 so i though this was a great way to do it ... $file_name2 = $oldpicgroup . "_to_" . $newpicgroup . ".txt"; $final_q = "SELECT * INTO outfile '/srv/www/htdocs/toolkit/loadfiles/$file_name2' FROM temp_att_table3"; $final_s = mysql_query($final_q) or die(mysql_error()); but the problem is it doesn know when to go to the next line and instead it puts in this squarish looking box thing. export example : its not really [] but when i paste this character turns into a \n if you will. so i typed in [] to represent what im seeing. LE WOY 1 Assembled []LE WOY 2 World Dryer it should look like : LE WOY 1 Assembled LE WOY 2 World Dryer Link to comment https://forums.phpfreaks.com/topic/96759-tab-delimited-problem/ Share on other sites More sharing options...
iPixel Posted March 18, 2008 Author Share Posted March 18, 2008 This is option two but not working so well hehe... //create the tab delimited text file $file_name2 = "loadfiles/" . $oldpicgroup . "_to_" . $newpicgroup . ".txt"; $fp = fopen($file_name2, "w"); //extact the data >> $final_q = "SELECT * FROM temp_att_table3"; $final_s = mysql_query($final_q) or die(mysql_error()); $final_r = mysql_fetch_assoc($final_s); $line = ""; do { $dpn_f = $final_r['dpn']; $pub_f = $final_r['pub']; $ak_f = $final_r['ak']; $av_f = $final_r['av']; $line .= "$dpn_f \t $pub_f \t $ak_f \t $av_f \n"; fwrite($line); } while($final_r = mysql_fetch_assoc($final_s)); fclose($fp); Link to comment https://forums.phpfreaks.com/topic/96759-tab-delimited-problem/#findComment-495167 Share on other sites More sharing options...
Barand Posted March 18, 2008 Share Posted March 18, 2008 With SELECT INTO OUTFILE there is a LINES TERMINATED BY 'x' option x should be \n for 'nix \r\n for windows \r for Mac Link to comment https://forums.phpfreaks.com/topic/96759-tab-delimited-problem/#findComment-495176 Share on other sites More sharing options...
roopurt18 Posted March 18, 2008 Share Posted March 18, 2008 The box-thing is an un-representable character. Actually it is a \n but there's a slight difference between operating systems: *nix: \n Windows: \n\r (or \r\n, I forget the order) Mac: \r When you view a text file in one OS created by another OS, if the text editor isn't very smart you will see those squares because of the inconsistency in the representation of a newline. Which OS did you create the file in and which one are you viewing it on? What text editor are you viewing it with? If you started on *nix and are viewing on windows, try opening it in wordpad instead of notepad. Link to comment https://forums.phpfreaks.com/topic/96759-tab-delimited-problem/#findComment-495177 Share on other sites More sharing options...
iPixel Posted March 18, 2008 Author Share Posted March 18, 2008 YOU GUYS ROCK! THANK YOU Link to comment https://forums.phpfreaks.com/topic/96759-tab-delimited-problem/#findComment-495183 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.