Jump to content

array or database?


nick5449

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
Link to comment
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
Link to comment
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. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.