Hi, i want know how can i know how many lines has a txt files that im reading. I need know that before work over it.
My problem is that my server doesnt allow me to enable a determinate ip mine to conect from my pc (using mysql administrator) to the server to do the backup here in my pc. I know how to write a txt file, but the bd is like 230mb. I was thinking in a system that write up to (for example) make a file of 1mb and then it done continue the backup in other file. Do im clear? that i need is how to control rigurously how many data i wroted and i would write in the next line and thus each time.
writing a file
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
I'm having difficulty understanding your english
but if I've understood you correctly you simply need to open the file in "append" mode:
This way you can write a line, then discard that line and each time you write to the file it just adds to the end of it. You'll save memory compared with writing in "write" mode (the w flag).
I hope that's what you were asking?
Code: Select all
$handle = fopen($file, "a+");I hope that's what you were asking?