File handling documentation
Moderator: General Moderators
-
Dilbert137
- Forum Commoner
- Posts: 57
- Joined: Sat Jun 02, 2007 5:02 am
- Location: Mauritius
File handling documentation
Dear All,
I need to create a function for updating pricelist on database and need some documentations on file handling on PHP. Could you please refer me a documentation?
Thanks and Best Regards
Dilbert137
I need to create a function for updating pricelist on database and need some documentations on file handling on PHP. Could you please refer me a documentation?
Thanks and Best Regards
Dilbert137
Last edited by Dilbert137 on Tue Jul 10, 2007 11:39 am, edited 1 time in total.
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
fopen, fread, fwrite are the only functions you need to know. 
You could use my CSV class to simplify matters, located here:
viewtopic.php?t=47855
Whats really weird, is you use the term database and file handling in the same sentance, which is accurate when using DB tin it's most generic sense. However in PHP when you say DB, you typically mean MySQL, SQLite, etc.
So just to clear things up, what exactly are you looking to use? DB or File system?
You could use my CSV class to simplify matters, located here:
viewtopic.php?t=47855
Whats really weird, is you use the term database and file handling in the same sentance, which is accurate when using DB tin it's most generic sense. However in PHP when you say DB, you typically mean MySQL, SQLite, etc.
So just to clear things up, what exactly are you looking to use? DB or File system?
-
Dilbert137
- Forum Commoner
- Posts: 57
- Joined: Sat Jun 02, 2007 5:02 am
- Location: Mauritius
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
-
Dilbert137
- Forum Commoner
- Posts: 57
- Joined: Sat Jun 02, 2007 5:02 am
- Location: Mauritius
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
When dealing with text files, textareas are actually perfectly fine. You'll be dealing with the exact same amount of data.
If you really don't want to use it, you should have already visited the resources we've given so far and looked into the file handling functions. The processing will be the same.
If you really don't want to use it, you should have already visited the resources we've given so far and looked into the file handling functions. The processing will be the same.
-
Dilbert137
- Forum Commoner
- Posts: 57
- Joined: Sat Jun 02, 2007 5:02 am
- Location: Mauritius
Sorry I don't really understand you. Maybe your solution is fine. My understanding of textarea is the testarea used in forms. Documentation is needful as it will be confusing. In IT there are so many way that it can be done but with textarea not for so huge data and when specific field have to be extracted.
I use textarea when there is wordings to be inserted in table field but not for specific data to be collect from.
<textarea></textarea>
Regards
Dilbert137
I use textarea when there is wordings to be inserted in table field but not for specific data to be collect from.
<textarea></textarea>
Regards
Dilbert137
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
If you have file that contains somezhing like
productid,price
productid,price
productid,price
you might be interested in http://de2.php.net/fgetcsv
productid,price
productid,price
productid,price
you might be interested in http://de2.php.net/fgetcsv
Code: Select all
<?php
$fp = fopen('data.txt', 'rb') or die('cannot open file');
while( !feof($fp) ) {
$row = fgetcsv($fp);
print_r($row);
}-
Dilbert137
- Forum Commoner
- Posts: 57
- Joined: Sat Jun 02, 2007 5:02 am
- Location: Mauritius
-
Dilbert137
- Forum Commoner
- Posts: 57
- Joined: Sat Jun 02, 2007 5:02 am
- Location: Mauritius