Zado
asked on
Read txt file with php and save it to mysql database
Hi,
I have a file on ftp: file.txt
I need a script to read it and save each line to different mysql cell, but same row.
Example:
FILE:
Sam
Pass
Other content
here
DATABASE:
id
name
password
comments
What I want here is: open the file, read it line by line and save it like so:
first line (Sam) to 'name' column
second line (Pass) to 'password' column
other lines (Other content here) to 'comments' column
I know I need to use fopen, fclose etc. but I need full script.
Thanks for any help.
I have a file on ftp: file.txt
I need a script to read it and save each line to different mysql cell, but same row.
Example:
FILE:
Sam
Pass
Other content
here
DATABASE:
id
name
password
comments
What I want here is: open the file, read it line by line and save it like so:
first line (Sam) to 'name' column
second line (Pass) to 'password' column
other lines (Other content here) to 'comments' column
I know I need to use fopen, fclose etc. but I need full script.
Thanks for any help.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER