Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- php or mysql
October 11, 2004, 4:05 pm
rate this thread
displayed in a random order. If lots of people are looking at it, would I be
better using a page that uses arrays and shuffle(), or would I be ok to use
If there are over a hundred visitors a day, would mysql be making the site
I don't know much about hardware, and if using mysql to get data for a front
page is too much, could it overload mysql?
Is there any point where it's better to use php to write html rather than
query a database everytime the page loads?
I would be very happy if anyone could explain this, because I could not find
the answer in books or on the web.
Re: php or mysql
You are far better off reading only the records/fields from the database
which you need and in the order you need them than to load the whole lot
into memory and process them there.
SELECT * FROM foo ORDER BY RAND()
If your site content doesn't change much then php/mysql will make the site
slower than having static html pages. However the cost of hardware is
comparitively little compared to the cost of you editing lots of files to
make a style change for instance.
If your design is bad, and you've got lots of other resource hungry
applications on the server then yes.
You need the data from somewhere, mysql (a.n.other rdms) happens to be in
most circumstances a lot easier and faster than embeding code into a
specific file. For example you can easily change the contents of the main
page using an CMS user interface rather then editing the file in a HTML
Editor and then uploading that file using FTP.