If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Chit Chat > Database Problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-15-10, 17:34
belask belask is offline
Registered User
 
Join Date: Sep 2010
Posts: 27
Database Problem

hello everyone.
I am in the beginning of learning about database. And I am at a loss to decide what programming language or software I should learn.
For a couple of days i have been experimenting with mysql (xampp), and i like it very much. But there's one thing i really disliked very much. That's I'am unable to properly view my database in a text-editor.
So which alternative strategy I should look forward to?

* My database will always contain only text. I will never add any audio,video or images etc to it.

* I want my databse to be viewable in a text-editor.

* I want my database to be accessible with sql or something similar in nature.

* The nature of my database will not be relational (if i correctly understood the definition of 'relational'). I mean, i can write my entire database in a table. Rows will be frequently added to it, Columns will be only rarely added, if added at all. But no additional table will ever be added.

* I want to be able to access my database from within php file.

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 09-16-10, 10:23
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
Use a text file. Relational databases are for relational data.
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
  #3 (permalink)  
Old 09-16-10, 10:34
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
Quote:
Originally Posted by Teddy View Post
Use a text file. Relational databases are for relational data.
...but then it won't be accessible via sql.

The poster wants to have his cake and eat it too. He wants all the efficiency and scalability of a sql database engine, but ignores the fact that these features require a degree of complexity in storage the precludes the files being viewable in a simple text editor.

That said, I suppose he could store the data in text files and then use opensql() or an ODBC connection to manipulate them from a database engine.

The word for that is "kludgy".
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
Reply With Quote
  #4 (permalink)  
Old 09-16-10, 11:05
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Quote:
Originally Posted by belask View Post
* The nature of my database will not be relational (if i correctly understood the definition of 'relational').
Perhaps you should define your understanding of relational?
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
Reply With Quote
  #5 (permalink)  
Old 09-16-10, 17:03
belask belask is offline
Registered User
 
Join Date: Sep 2010
Posts: 27
Thanks everyone for giving me time.

Quote:
Originally Posted by pootle flump View Post
Perhaps you should define your understanding of relational?
according to my understanding, relational database contains (or can contain) more than one tables. And those tables are or can be interconnected. This makes the database too complex to be written in xml or any flat-file database.

I must make it clear that i have only 2 days experience with sql (xampp), which is my first attempt at database.
Reply With Quote
  #6 (permalink)  
Old 09-16-10, 17:29
belask belask is offline
Registered User
 
Join Date: Sep 2010
Posts: 27
Let me once again clarify, why i want to create a database.

During geocities days, i had a website which contains poems. There were about 200 poems and every poem was written in a separate HTML file. Apart from this there was 1 .js and 1 .css file to control the HTML files.

After some years of experience with web-designing i realized that although css is very helpful in terms of controlling HTML files, however sometimes i have to edit all the HTML files.

After that i started thinking of PHP and database.

Now i want to redesign my website. I want to generate pages instead of writing each poem in a separate HTML file. So that i have to edit only one php file instead of editing so many HTML files. I have some experience with PHP, so PHP is not a problem.

But i also want to keep all the poems in one single database, and i want all the benefits of sql or something similar.

My poems will contain following fields:
Name of poem
Poem itself in roman script.
Poem itself in Urdu script.
Name of the poet.
Poem Description if available.

More poems will added frequently. Poem fields may also rarely be added. But i am certain i will never add any image or multimedia file to it.
If poems are rows and poem fields are columns, then i am sure, there always will remain only one table. No additional table will ever be added.
So according to my understanding the type of database i am going to create is not "relational".

Last edited by belask; 09-16-10 at 17:32.
Reply With Quote
  #7 (permalink)  
Old 09-16-10, 18:09
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
What perceived benefits of sql are you looking to gain?

You do know you can load a flat text file into a dataset and work with it as if it came from a database, right?

Also, you might want to familiarize yourself with some of the CMS products out there. It may be overkill for your scenario, or it may be awesome. Either way, it's worth looking.
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
  #8 (permalink)  
Old 09-16-10, 19:15
belask belask is offline
Registered User
 
Join Date: Sep 2010
Posts: 27
Quote:
Originally Posted by Teddy View Post
What perceived benefits of sql are you looking to gain?
During my 2 days experimenting with sql i liked the way i was able to generate selected rows and columns.

for example:
SELECT column_name(s) FROM table_name
SELECT * FROM table_name
SELECT DISTINCT column_name(s) FROM table_name
SELECT column_name(s)
FROM table_name WHERE column_name operator value

This all was easy, fast and fun.

Quote:
Originally Posted by Teddy View Post
You do know you can load a flat text file into a dataset and work with it as if it came from a database, right?
I have only vague idea about this.

Quote:
Originally Posted by Teddy View Post
Also, you might want to familiarize yourself with some of the CMS products out there. It may be overkill for your scenario, or it may be awesome. Either way, it's worth looking.
CMS means? (altough i could have looked up its meanings elsewhere but i asked you to make you know that i don't have any knowledge about it.)
You may advise.
Reply With Quote
  #9 (permalink)  
Old 09-16-10, 20:08
belask belask is offline
Registered User
 
Join Date: Sep 2010
Posts: 27
Quote:
Originally Posted by blindman View Post
...but then it won't be accessible via sql.
bad news.

Quote:
Originally Posted by blindman View Post
He wants all the efficiency and scalability of a sql database engine
By "All" i meant all i knew about sql at the time of posting this thread, that was 2 days of learning/experimenting experience with sql.
or "All" that i possibly ever need. (Note: I have no plans to take database as professional carrier. I just need it for my personal and limited use.)

Quote:
Originally Posted by blindman View Post
but ignores the fact that these features require a degree of complexity in storage the precludes the files being viewable in a simple text editor.
Since the database i am gonna create is not complex at all. It's so simple that i myself can write it in an xml file. Therefore sql should give me option to save it in xml or other plaintext format. I have listened about some xml plug-in for xampp. However before giving it a try i decided to get some help on this forum.

Quote:
Originally Posted by blindman View Post
viewable in a simple text editor.
Well I strongly want my data to be readily available in all conditions (even if sql is not installed).
However i can compromise on it, if alternative method is fast, easy and needs little coding . If database can still be easily backed-up and there's no chance of data-lost.

Quote:
Originally Posted by blindman View Post
That said, I suppose he could store the data in text files and then use opensql() or an ODBC connection to manipulate them from a database engine.
So many new terms and things to learn my brain might blow away.
Reply With Quote
  #10 (permalink)  
Old 09-16-10, 20:45
SimonMT SimonMT is offline
Registered User
 
Join Date: Sep 2006
Posts: 265
You can suck text on a page and use SQL. I don't know PHP but here is what you do in ASP.

Firstly your your query has Poem Reference or ID. You call each Poem in a QueryString so that the recordset knows which Poem to Select.

Poems.aspx?Poem=1

Poem file could be simply 1.htm(l)

Poems.aspx has all the SQL statements, header, tags and body declarations.

The file with the poem only needs the tags relating to the css file <div> <span> or <p>

The file name should relate to PoemID or Reference so that within the SQL the filename can be specified. Now that we know the Poem and the Poem file we can:

Select the record

Sql ... WHERE PoemQuery.[PoemID] = '" & Request.QueryString("Poem") & "'

Then to get the file within the body:

Code:
        PoemFile = rs.Fields.Item("Poem_File").Value
        incFile = Server.MapPath(PoemFile)
        fs = Server.CreateObject("Scripting.FileSystemObject")
        tmpFile = fs.OpenTextFile(incFile, 1, False)
        tmpStr = tmpFile.readall
        Response.Write(tmpStr)
        tmpFile.close()
        tmpFile = Nothing
        fs = Nothing
Then close any div table body and html tags.

Basically your Querystring tells the recordset which poem to select and from that you know from the record what htm(l) file to associate with tthat record. You only need one Page to handle all your Poems.

You can not use Includes as these are processed before the Recordset and therefore are not dynamic.

Simon
Reply With Quote
  #11 (permalink)  
Old 09-17-10, 10:00
belask belask is offline
Registered User
 
Join Date: Sep 2010
Posts: 27
Thanks simon.
However, i have successfully tried pulling database with php to be displayed in html.
for this i used the following two combinations separately.
php + xml + expat parser
php + mysql + sql

I think both strategies have their pros and cons. And i decided to keep experimenting with both of them, in order to get more understanding.

Somehow i don't like to choose ASP, IIS and other microsoft products. You know many people prefer PHP+Apache over ASP+IIS.

I may learn ASP, but i wont use it for my database.
Reply With Quote
  #12 (permalink)  
Old 09-17-10, 10:30
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
Get away from SQL. You should be looking at learning how to do this in PHP. You don't need or want SQL for this task, I assure you. Google up "parse text file php".
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
  #13 (permalink)  
Old 09-17-10, 18:02
belask belask is offline
Registered User
 
Join Date: Sep 2010
Posts: 27
Quote:
Originally Posted by Teddy View Post
Get away from SQL. You should be looking at learning how to do this in PHP. You don't need or want SQL for this task, I assure you. Google up "parse text file php".
Ok let me look at it. I will post my experience with it, within a couple of days.
Reply With Quote
  #14 (permalink)  
Old 09-18-10, 11:53
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Quote:
Originally Posted by belask View Post
But no additional table will ever be added.
You don't need SQL to do what you state but wouldn't your system be better if it could hold details on:
  • The author of a given poem
  • The different styles of poem
  • The different periods when the poetry was produced
  • Links to similar poems or poets
  • Users of the system
  • Feedback on poems from users
... in other tables.
__________________
Mike
Reply With Quote
  #15 (permalink)  
Old 09-20-10, 20:41
belask belask is offline
Registered User
 
Join Date: Sep 2010
Posts: 27
Quote:
Originally Posted by Teddy View Post
Get away from SQL. You should be looking at learning how to do this in PHP. You don't need or want SQL for this task, I assure you. Google up "parse text file php".

Quote:
Originally Posted by belask View Post
Ok let me look at it. I will post my experience with it, within a couple of days.
Ok now i have tried it. My observation is:

Although this way flat-file is viewable in text-editor yet it's looking a bit dirty and will get even more dirtier over time. So there should be some formatting in it. Therefore i prefer xml over other flat files.

But parsing xml or other flat-files doesn't seem to be as easy and dynamic as it is with mysql+sql+php. Specially in the long run.

So i think i should still go with mysql+sql+php. Although i will keep practicing xml parsing.

And for being able to view the data in text-editor, I will export the data in xml.
Being able to view the data is important to me, but only when mysql is not installed or is unaccessible, and the data is desperately needed at the moment.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On