Jump to content

Tab Delimited Problem...


iPixel

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.