Jump to content

Does my project need MySQL?


Chamza

Recommended Posts

Hello everyone, I don't know much about MySQL, but if it is needed for my project I am willing to learn it.  I am making a website like StumbleUpon.com, and I have pretty much created the site.  Basically, I have thousands of links stored within each category, and when a button is pressed, a random link from the category that is chosen will be displayed.

 

Currently, I have these links in a PHP array, which not only makes it difficult to modify the links, but when the user views the page source, they can see all the links (which i dont want)

 

All i know about MySQL is that its a database, and I was wondering if storing the links within mySQL was possible, and if it is possible, how would I go about doing it?  Furthermore, how do i connect it with my php array?  Thanks.

Link to comment
Share on other sites

Does my project need MySQL?

No project NEEDS MySQL. There are a lot of reasons to use it, but never feel like you have to use it.

 

Currently, I have these links in a PHP array, which not only makes it difficult to modify the links

For something simple like this, just keeping the links in a file might be easier. Putting them into MySQL won't make them any easier to edit. You would still need to create some sort of front end interface for managing them.

 

but when the user views the page source, they can see all the links (which i dont want)

If they are in a PHP array, the user shouldn't be able to View Source and see the entire list...

 

All i know about MySQL is that its a database, and I was wondering if storing the links within mySQL was possible, and if it is possible, how would I go about doing it?  Furthermore, how do i connect it with my php array?  Thanks.

If you want to keep it simple, stick with a flat file. If you want to start tracking anything else though (like visits, popularity, users, etc) you will probably want to start using some sort of database (MySQL being the most commonly used). To help you get started, check out this (specifically PHP 101 (PART 8): Databases and Other Animals)

http://devzone.zend.com/node/view/id/627

Link to comment
Share on other sites

Thanks for the quick reply.  Haha, sorry for all the assumptions, most notably

but when the user views the page source, they can see all the links (which i dont want)

It is a relief to hear that they cant, that was my primary concern.

Link to comment
Share on other sites

I mean...they won't be able to unless you echo the entire array out. The source for the PHP file you see is not what the user can see. The easiest way to understand is just do it, write a script and then load it up and do a View Source on the page. It only shows what PHP tells it to show.

Link to comment
Share on other sites

I would argue that your project at least deserves MySQL.  You are going to want to record which user has visited which site or they will be sent back there again.  You are going to want user accounts so the user can choose categories and then you need to remember those categories.  Presumably you will want some sort of thumbs up and down system and again those need to be stored.  A relational database allows all that to be added when you implement it.

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.