Jump to content

Archived

This topic is now archived and is closed to further replies.

nirvana

Retrieve Data from Text file

Recommended Posts

Hi All,

I was wondering if someone can help me with this.

I am trying to retrieve data from text file - and the location (the path) of that text file is saved in mySQL database.
I am wondering if there is a way of retrieving that data.
Sorry I am new to PHP and I have done a few queries to retrieve data from database but would like to know if the above approach is feasible.

thanks in advance,
nirvana

Share this post


Link to post
Share on other sites
Take a look at the fopen and fwrite commands. That should get you started in the right direction.

Share this post


Link to post
Share on other sites
It is very possible :) What format is the text file? Post the contents of it, or a sample, so we can help you out a little bit better :)

Share this post


Link to post
Share on other sites
[!--quoteo(post=380889:date=Jun 7 2006, 01:50 AM:name=Prismatic)--][div class=\'quotetop\']QUOTE(Prismatic @ Jun 7 2006, 01:50 AM) [snapback]380889[/snapback][/div][div class=\'quotemain\'][!--quotec--]
It is very possible :) What format is the text file? Post the contents of it, or a sample, so we can help you out a little bit better :)
[/quote]

Hi,

The text file is comma delimited and here is the sample:

1,191.400,-45.8,0
1,191.405,-44.6,0
1,191.410,-40.6,0
2,191.500,-50.5,0
2,191.505,-48.2,0
2,191.510,-45.3,0

some text files contain more than 4 columns and they are the data of channel, frequency, loss, attenuation etc.

thanks,
nirvana

Share this post


Link to post
Share on other sites
[!--quoteo(post=380949:date=Jun 7 2006, 06:37 AM:name=nirvana)--][div class=\'quotetop\']QUOTE(nirvana @ Jun 7 2006, 06:37 AM) [snapback]380949[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Hi,

The text file is comma delimited and here is the sample:

1,191.400,-45.8,0
1,191.405,-44.6,0
1,191.410,-40.6,0
2,191.500,-50.5,0
2,191.505,-48.2,0
2,191.510,-45.3,0

some text files contain more than 4 columns and they are the data of channel, frequency, loss, attenuation etc.

thanks,
nirvana
[/quote]


Forgot to mention one more thing. I am going to use these data to plot the graphs using JpGraph. I wrote a program to plot the graphs using php and jpgraph but the data were retrieved from database directly. Now the data location has changed and they are saved as text file and need to access those files in order to plot the graphs.

thanks,
nirvana

Share this post


Link to post
Share on other sites
You can use explode() or split() functions:

[a href=\"http://www.php.net/explode\" target=\"_blank\"]http://www.php.net/explode[/a]
[a href=\"http://www.php.net/split\" target=\"_blank\"]http://www.php.net/split[/a]

Share this post


Link to post
Share on other sites

×

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.