Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 09-24-2008, 07:38 PM Only 1 line output
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
This script results in one line of output to file, what am I missing?

PHP Code:
 <?php
$conn 
mysql_connect("xxx","xxx","xxx"); 
mysql_select_db("xxx",$conn);
$OutputFile fopen('Orders.txt','w');
$SQL="Select ProjectID From Projects";
$ProjectInfo mysql_query($SQL);
while (
$Info mysql_fetch_array($ProjectInfo))
    {
        
$SQL="Select FileName From PreviewPhoto Where ProjectID = ".$Info['ProjectID'];
        
$PreviewPhoto mysql_query($SQL);[/color][/b]
        while (
$Photo mysql_fetch_array($PreviewPhoto))
            {[/
color][/b]
                
fwrite($OutputFile$Photo['FileName'].", ");
                
$SQL "Select Text From PreviewText Where ProjectID = ".$Info['ProjectID'];
                
$PreviewText mysql_query($SQL);
                while (
$Text mysql_fetch_array($PreviewText))
                    {[/
color][/b]
                        
fwrite($OutputFile$Text['Text'].", ");
                    }[/
color][/b]
                
fwrite($OutputFile,"\n");
            }[/
color][/b]
    }   [/
color][/b]
fclose($OutputFile);       
?>[/color]

Last edited by Sleeping Troll; 09-24-2008 at 08:10 PM..
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-25-2008, 02:44 AM Re: Only 1 line output
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Newlines?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 09-25-2008, 05:25 AM Re: Only 1 line output
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
I suspect that the culprit is windows notepad, if you try to use it to view the generated file. Windows "new line" characters are "\r\n" (Carriage return + line feed) Linux is "\n" (New line) and mac is "\r" (Carriage return) Notepad must have an \r\n sequence to show a new line. Try to open the file in wordpad, rather than notepad. This program can handle unix/mac new lines, and should display it correctly.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 09-25-2008, 05:37 AM Re: Only 1 line output
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
fwrite($OutputFile, $Photo['FileName'].", \n");
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 09-25-2008, 06:21 AM Re: Only 1 line output
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Not sure... It looks like he is generating a csv, or something similar. For what I understand, he need several values on one row, separated with comma and then a new line.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to Only 1 line output
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14883 seconds with 12 queries