473,473 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

inserting files text from DIR to MySQL

Hi,
My problem is a little advance I feel, please check it and guide me if
you can.

I have a lot of similar format text files, that has name in the first
line then age in forth line second and then discription of the person
in the 6 line which is a lot of text para and does not have any <br>
tag.

What I want is to have a script that can read the files in the folder
and populate the database with all the files.

I can play with php a little but I am not a programmer of that quality
so I wanted to read more of the php for this perticular script,

I will be thankful if any one from can tell me what things in php I
read to study and if there are any resources that I can use to get it
and can use for this script.
I know php I can install and make database applications and I am
comfortable till variables and DB based applications, however
functions, classes and arrays are something that i am not a expert of.

I think my question is a little dump but i cant pay and i need this
script...lol please send the query that i should google.

Thank you very much

Regards
Jaunty Edward
Jul 17 '05 #1
2 1522

"Jaunty Edward" <sm***********@hotpop.com> schreef in bericht
news:1e**************************@posting.google.c om...
Hi,
My problem is a little advance I feel, please check it and guide me if
you can.

I have a lot of similar format text files, that has name in the first
line then age in forth line second and then discription of the person
in the 6 line which is a lot of text para and does not have any <br>
tag.

What I want is to have a script that can read the files in the folder
and populate the database with all the files.

I can play with php a little but I am not a programmer of that quality
so I wanted to read more of the php for this perticular script,

I will be thankful if any one from can tell me what things in php I
read to study and if there are any resources that I can use to get it
and can use for this script.
I know php I can install and make database applications and I am
comfortable till variables and DB based applications, however
functions, classes and arrays are something that i am not a expert of.

I think my question is a little dump but i cant pay and i need this
script...lol please send the query that i should google.

Thank you very much

Regards
Jaunty Edward


Hi Jaunty,

You should open the dir with something similair like below:

$handle=opendir('D:/mydir/');

while (false!==($file = readdir($handle))) {

$contents = file('D:/mydir/'.$file,"r"); // $contents is an array
containing every line of the file

$age_line = $contents[0]; // $age_line contains also the end of line
character(s) so you will have to remove them

$person_description_line = $contents[5];

// after retrieving data from file put your sql statements here

}

closedir($handle);

Try something like this, the above isn't tested by me but should point you
in the right direction.

Regards,

Marcel
Jul 17 '05 #2
Hi,
thank you so much I will try this and start studying similar things,
thank you very much Marcel.
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Frank Pryor | last post by:
Hello, I'd appreciate suggestions as I hash out my idea. Perhaps I'm going about this the wrong way. I have users using a third party windows application. They can export data from this...
1
by: ketulp_baroda | last post by:
Hi I am storing the attachment in the database. For some file the data gets stored in the database but for other files it gives a MySql error. For eg. when I am trying to attach the file say...
1
by: ajk | last post by:
. Hi, All: I know how to insert files into a Word doc using C#. However, the program I've written to do this runs much too slowly. The "myObj".Application.Selection.InsertFile method executes...
1
by: Aido82 | last post by:
Im having a problem inserting the following data into a Mysql table, just wondering if any one has any ideas on how to get it to work. When i click the register button nothing at all happens . any...
1
Ajm113
by: Ajm113 | last post by:
Ok, when I was new to this I had this problem and I bet a lot of other people did when they where new to PHP and Mysql. So this mite be your question; "Ok, no errors or warnings in mysql and php so...
221
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
6
by: Bunty | last post by:
I want to insert values in the database.If i insert values one by one then it works till 4 or 5 fields then after it gives error.In my database there are more than 20 field.Pls help me.
5
by: atlanteavila | last post by:
Hello all, I have a problem with inserting text with quotes, or html code in to a MYSql Database. I've been trying to create my own content management system, and unfortunately I've come accross a...
4
by: ghjk | last post by:
I wan to add some data using php page to mysql db. But I got the error saying "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.