Jump to content

Archived

This topic is now archived and is closed to further replies.

nick5449

array or database?

Recommended Posts

I'm new to php and have a few questions.  I want to have a page on my website where people can leave messages.  Can I simply do this with arrays in php or do I need to use a mysql database?  If I do need a database, do I need any extra software or can I just use a basic text editor and upload the code to the server?  Thanks

Share this post


Link to post
Share on other sites
An array only exists while the current script is running. You are going to have to store the messages somewhere, either in a database table or in a text file (flat file).

A simple text editor will suffice but it's a lot better to use a specialist code editor.

Have a look at http://www.php-editors.com

Share this post


Link to post
Share on other sites
arrays do nothing for permanently storing values (such as messages from people).  yes, you would need to have a database that holds it, or at least store the information in a flatfile (like a text file). 

database option: it depends on what your hosting package is.  do you buy hosting from someone, or do you have your own computer setup as a server?  hosting packages usually always include the ability to setup at least one database. the software is already on their server.  Go to cpanel or contact your hosting provider for help. 

flatfile option: you would basically have a seperate file in your directory. you would then use php to open the file and get the contents and display it. if someone posts a new message, it would open the same file and add the new message into the file. 

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.