Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quick Question about echo

Status
Not open for further replies.

nedstar1

IS-IT--Management
Mar 2, 2001
127
US
Hi Folks,

I'm building a query to pull names and addresses out of my mySQL db to insert into a csv for upload to FedEx.com address book.

I have the query built, and I am building the csv file now using an intricate echo command. It is erroring, and I think I know why, but not how to avoid it.

The FedEx CSV file has two fields in which the default value is supposed to be "null" - I have it in my command as:

Code:
echo ($row_rs_fedex['mailingID'] . ', ' . 'null' . ', ' . $row_rs_fedex['firstName'])

Shortened to make it fit nicely. I can remember needing to do something special to this null value so that the echo statement just echos it and doesn't try to parse it - is it \'null\' or similar?

I know this is easy for someone - give me a hint!

TIA

Nedstar1
 
Can you give us an example of what a line in the CSV file is supposed to look like?

Also, the echo statment will write to the screen not to a file, use fwrite() write to a file. You don't need the parenthessis "( )" in an echo statement.

Ken
 
Hi Ken,

Thanks for the tip with the fwrite - I'll research the command this evening.

As for the SQL, I had left out a concatenation sign '.' between two of my fields, leading to a parse error. I wound up breaking down the statement onto separate lines to try to debug that way, and caught my own error in the process. It works now.

Just as an FYI, it's a line of recent odering users for upload to FedEx.com address book. When a user places an order, their userid ifs flagged for inclusion on the list - I upload/overwrite, and I have three clicks to prepare my labels!

Thanks for the reply and the tip on fwrite().

(I knew I didn't need the parens with echo, but I get easily confused.

TIA

Nedstar1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top