i need a solution/ code to convert txt file values into a csv file and the csv file should be inserted into Phpmyadmin
Actually the text file contains the results of a student...etc
Please help me out as ASAP
Thanks Deepu
londrum
11:13 am on Apr 16, 2010 (gmt 0)
it depends how the .txt file is arranged at the moment. you should paste up an example here. you need to make it so each 'field' in the database has an entry in the text file. which means you might have to introduce some blanks, if they are missing. if all the data in the text file is already seperated out with commas, or semi-colons, or whatever, then it could be as simple as just renaming the file type extension to .csv
Its all scrambled.....hallticket no and name are merged in one line....failed students marks can be visible...the student who passes his marks are not visible he can only view his grade......
totally its very scrambled
w8ting for u r solutions
Thnks Deepu
londrum
10:53 am on Apr 17, 2010 (gmt 0)
if the hash lines are uniform across the whole file, then you can use preg_replace to replace every seven hashes with two commas, which will turn them into blank fields.
and i would replace every space with a comma as well, which will take care of most of the rest, but then you will have a problem with their names, because it will split up their christian/middle/surnames. you'd have to come up with a regular expression which only replaces spaces with commas if one of the characters on either side is a non A-Z character. im sure one of the brainboxes here will know how to do it.
jatar_k
3:04 pm on Apr 19, 2010 (gmt 0)
it doesn't seem scrambled
12 chars == id from 13 -> first nonalpha preceded by a space == first/last name (could also just be space first space last space) next 43 chars == something, not sure what but its 43 chars (the trailing space is included in the field as it disappears sometimes) then the mark, either FAIL or a grade, you would have to look and see if any - or + occur then finished by a space and -999999 not sure if that changes but you could look at the file
whoever produces this file could probably give you a format
saideep2007
5:59 am on Apr 20, 2010 (gmt 0)
thanks for the replys...i will test and get back to you
saideep2007
6:46 am on Apr 20, 2010 (gmt 0)
guys u r ideas have been worked........many many thanks nice solutions.........
g1smd
8:16 am on Apr 24, 2010 (gmt 0)
I hope those aren't real names and real personal data.