Hi Monks,
I'm intending to set up a database (assuming the server doesn't have DBI and mysql) to store students' profiles, grades for various online tests, information of login etc.
Since I probably won't be using DBI and mysql, I'm left with the option of storing the records in a flat textfile.
I've thought of two ways to go about storing the data in a textfile but have no idea which one is better. The following are the two ways I've in mind :
1) Use a single textfile
The entries in the textfile would look something like this (just a quick example):
pupil1==
maths:1_80:2_90
english:2_75:3_75
lastlogin:May 21
pupil2==
maths:1_68:2_87
english:2_75:3_75
lastlogin:May 12
(1_80 means Test 1 score 80)
2) Use multiple textfiles named as the name of the students
If a student is named "Peter", then the textfile would be name "Peter.txt". Of course, this runs into problems when there is more than one student with the same name but I reckon I can do something to the name to make it unique or perhaps use some kind of number identification. The entries in such a single student file would roughly be similar to those above except that they are only for one student.
Regardless of the methods used, I'll writing a script to parse the file and display the person's data in a web format so that the student can view his records dynamically.
I've to take into consideration the situation in which more than one student is accessing the tests or doing stuff that requires updating his or her records in the textfile.
My question thus is: Which of the above two methods is more efficient? Any comments on the way I approach the task would be very much appreciated.
Thanks in advance :-)
kiat
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.