Save string data in .php file on host

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phphelpme
Forum Contributor
Posts: 261
Joined: Sun Nov 21, 2010 3:32 pm

Save string data in .php file on host

Post by phphelpme »

Hi, I need to be able to save multiple string values to a .php file. My current coding echo's the results but getting it to save all the data and not just one entry to a file I am struggling with. Basically, we need to extra product values from a site that is not being maintained by ourselves and we are completing this manually, so I created this code to allow us to extract the product ids and names then output them but need to save them into a file for the rest of my system to call.

Here is my coding so far:
The above coding checks all links and extracts a string value from each, then output them on a webpage. As you can see from the coding, it echo's (echo $sid.",".$nam.",";) the values but I can not seem to get it to save all the values in the file seperated by a comma. It will only save on entry from each string and stop. Can anyone help me so I can save all instances of the 2 strings to my .php file?

The id of site to use comes from a form that a fields saves to $app :banghead:

Any help would be great as racking my brains trying this out now... lol :roll:

Thanks very much people...

Jason.
Last edited by phphelpme on Tue Nov 23, 2010 8:04 am, edited 2 times in total.
phphelpme
Forum Contributor
Posts: 261
Joined: Sun Nov 21, 2010 3:32 pm

Re: Save string data in .php file on host

Post by phphelpme »

Also, when the coding echo's the string data it all appears in one line... for example:

number, name, number, name, number, name,

I need all the values saved to the .php file like the above example. That is why the script echo's them in this way. I have to copy and paste from this executed script and manually insert into a .php file and ftp this file to the required directory. The rest of the system is automatic but this step seems to be puzzling me. I know I prob have to stat that I need all values saving but not sure how to code this so it saves it in my required file.
phphelpme
Forum Contributor
Posts: 261
Joined: Sun Nov 21, 2010 3:32 pm

Re: Save string data in .php file on host

Post by phphelpme »

Anyone know of anyway of getting this script to save all the listed data and not just one entry from each string please? kind regards.
phphelpme
Forum Contributor
Posts: 261
Joined: Sun Nov 21, 2010 3:32 pm

Re: Save string data in .php file on host

Post by phphelpme »

The problem for saving the string values to file has been solved using a data array:
Just wanting to know, how I allow the user to select which order they want the values saved in. i.e. allow them to select which ones comes first, second, third etc. No really sure how to go about complete this.
Post Reply