Page 1 of 1

getting whole page from database

Posted: Fri Apr 25, 2003 6:20 am
by legaxy
I have found my site is beginning to get too big, too many files, becomes confusing when using login forums due to the structure of links and location of files. :(
I am planning to put all the page contents in the mysql db and just pull it out using variables like in index.php?page=...
I want to know is this safe to do, how would its speed compare to using the flat files? what type of column should I use? Blob, longtext ... or...? :?

and can i just dump the whole php file into a db field and not need to edit it?

Thanks all!

btw...
planning to use

Code: Select all

<?php
SELECT from pages where page = $page
?>

Re: getting whole page from database

Posted: Fri Apr 25, 2003 6:33 am
by []InTeR[]
legaxy wrote:what type of column should I use? Blob, longtext ...
Type's:
  1. * Char Max 265 chars
    * TinyText Max 264 chars (not sure)
    * Text Max 65535 chars
    * MediumText Max 16777215 chars
    * LongText Max 4294967295 chars
Just look what the biggest file is, an take your pick.

Posted: Fri Apr 25, 2003 7:20 am
by volka
complete pages/scripts in the database... I don't like that very much.

http://www.php.net/manual/en/configurat ... epend-file may help to prevent you from forgetting the login part (can be done in .htaccess for certain directories if you like).
You might also put all files in a .htaccess protected directory with allow None permission and have an index.php that dispatches all requests (include will still work)

Posted: Fri Apr 25, 2003 8:26 am
by Jim
If you get a lot of hits, pulling information from your mysql db every time someone wants to access a page will be a bit straining and resource intensive.

I suggest you just run through your files, find a better way to organize them (use sensible directories and filenames) and re-do the links. It'll probably take less than or as much time as it would to enter all these articles in the database, and it will save you some loading time as well.

Posted: Fri Apr 25, 2003 8:45 am
by []InTeR[]
Maybe you must download a good CMS in php?

@ my work, the php and html is totally seppareted.
And all that thnx to Yapter.

Posted: Fri Apr 25, 2003 12:56 pm
by m3mn0n
I had the same dilemma, I ended up picking to use .inc/.php files rather than mysql db with contents because like Jim said, it slowed my server down considerably when it got busy.

Posted: Fri Apr 25, 2003 2:36 pm
by airo
Jim wrote:If you get a lot of hits, pulling information from your mysql db every time someone wants to access a page will be a bit straining and resource intensive.

I suggest you just run through your files, find a better way to organize them (use sensible directories and filenames) and re-do the links. It'll probably take less than or as much time as it would to enter all these articles in the database, and it will save you some loading time as well.
Just to elaborate on this abit further, i think its either 7 or 17 simultaneous(sp?) page views before a mysql DB starts to get a workload.