Jump to content

Recommended Posts

I'm getting closer! Right now, I want to export a small amount of data to a .csv: a purchase order number followed by "1", i.e. "61751,1" and I need for the file to have a unique name, preferrably something like ponum_export, i.e. 61751_export.

 

So, I managed to get the file to write and name if I provided static data. The problem arises because I have my po_num stored in a variable. Here's the code I have now:

 

//Output to a .csv: "po_num,1" to trip the validate flag in SAGE
	$list = array (
	'$curr_po_num,1'
	);

	//Give it a unique name to avoid possible conflicts if Batch is delayed
	$fp = fopen('$curr_po_num_validation.csv', 'w');

	foreach ($list as $line) {
		fputcsv($fp, split(',', $line));
	}

	fclose($fp);

 

The problem is that I get a file named "$curr_po_num_validation.csv" and the file contains "$curr_po_num,1". Meaning that instead of the value of $curr_po_num, I get "$_curr_po_num"  :D

 

There must be a simple answer that I am too goofy to see. Thoughts?

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.