|
-
Jul 29th, 2002, 05:26 PM
#1
Thread Starter
Member
Database as a txt file
Hi,
I'm new to php and till now it was going pretty good till I encountered a problem. The database that I want to query appears as a txt file on the internet. I want to know how I can make/execute SQL queries using mysql on this db. Also how do I convert db's to txt files.
Thx.
Link to db : http://npaweb01.planetarion.com/botf...net_listing.gz
-
Jul 29th, 2002, 05:38 PM
#2
Stuck in the 80s
You can't use MySQL on a text file. It has to be a MySQL database. Unless I'm confused here.
-
Jul 29th, 2002, 05:59 PM
#3
Thread Starter
Member
Forgive me. What I meant was how do I convert txt files into db's. Does the txt file have to be in a particular format?
I am currently using phptriad and it has phpmyadmin in it. I tried to use it to convert a txt file into a db but it keeps giving me an error.
Also, do I have to make the db manually first before I try to insert a txt file into it?
Thx.
-
Jul 30th, 2002, 09:42 AM
#4
Frenzied Member
yes you have to make the db table first before you insert the info into it. it all depends on how the info is stroed in the txt file as how it goes into the table. what columns do you have? what rows will you have? a lot of factors goes into creating a DB table. you just can't insert a txt file and think things will be ok.
-
Jul 31st, 2002, 02:43 PM
#5
Thread Starter
Member
Thx.
I did all that, made the table manually and even entered a couple of records just to be sure.
Whenever I try to insert a txt file into a table it gives me an error saying that some tmp file wasn't found. I am quite sure I've entered information such as seperator etc properly.
Btw I'm using phpmyadmin(which comes with phptriad) for doing all this.
Please help.
Thx.
-
Jul 31st, 2002, 02:49 PM
#6
Fanatic Member
To be honest it is best to write your own conversion tool. For example say your text file has the following format:
value01:value02:value03:value04
value11:value12:value13:value14
Where each new line is a new record and values are seperated by colons
What you would need to write is a php script that opens and reads that file line for line, exploding each line at the :, making an array of 4 values.
Then you use your pre-defined MySQL table that you built and give each field one of those four values, then go to the next line in the file.
-
Jul 31st, 2002, 03:12 PM
#7
Stuck in the 80s
Originally posted by cpradio
To be honest it is best to write your own conversion tool. For example say your text file has the following format:
value01:value02:value03:value04
value11:value12:value13:value14
Where each new line is a new record and values are seperated by colons
What you would need to write is a php script that opens and reads that file line for line, exploding each line at the :, making an array of 4 values.
Then you use your pre-defined MySQL table that you built and give each field one of those four values, then go to the next line in the file.
Good call
-
Jul 31st, 2002, 04:23 PM
#8
Frenzied Member
Originally posted by SystemShock
Thx.
I did all that, made the table manually and even entered a couple of records just to be sure.
Whenever I try to insert a txt file into a table it gives me an error saying that some tmp file wasn't found. I am quite sure I've entered information such as seperator etc properly.
Btw I'm using phpmyadmin(which comes with phptriad) for doing all this.
Please help.
Thx.
as far as I know phpMyAdmin will only except a certain format. what is the txt file? show us a couple of lines from it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|