I’m new to web-design and I need help setting up a database? Can anyone shed some light?
shed designs 2 Comments »I am definitely new to creating a website, but the one I’m interested in designing will require viewers to submit info. How do I set up a database (I’ve already set up MySQL and MyAdmin) to where I can go in and review their info? Any help will be appreciated!
Let me just add, I need these things explained to me in novice terms. Again, I’ve no clue as to what I’m doing. Thank you!
So, the first thing you have to know is that a website cannot directly interact with a database. When you have a form, it has two required attributes – action and method (i.e., when putting the form on an html page, you have to put "form action="whatever" method="post/get""). The action part tells the page where to send it to, and the method part tells it how to send it. Typically, you’re going to use post.
So, the browser then submits the information to the program that handles the info. This is where the programming languages come in. There are many types that can handle it – some common ones include CGI, PHP, Java, etc. Personally, I’ve used PHP and Java, ASP, and occasionally CGI, but it’s sort of a bear. PHP is probably the easiest, but Java can let you do some pretty cool stuff with it too. Unfortunately, unless you’re versed in some server-side language, you might have a bit of learning to do.
By server-side language, I mean a language installed on the server side where your website is hosted. If your hosting site doesn’t have Java installed, for instance, there’s no reason to go and learn it and set up servlets/java server pages to handle your stuff. Most have PHP or ASP, but you’d have to check to be sure.
Once you’ve determined that, you need to get ahold of a database connector for that language. Again, even these programs can’t directly communicate with a database – they need what’s called a driver to do so. They communicate through the driver using what’s called an API (fancy acronym for different methods you can call to do stuff) to speak with the database and make changes and such.
Now, that being said, this can get pretty hairy, and it’s best if you can install a local version on your machine and test it out to see how things work before you go playing around with it on the live side too much.
You also want to be aware that there are things called SQL injection attacks that can leave your site vulnerable, and you’ll want to read up on precautions for dealing with that.
Anyway, I know this isn’t a comprehensive answer, but at least it might point you in a direction of where to begin. Unfortunately, there’s really no super-easy way to deal with this at this time, but once you get one of the languages down, it’s not so bad.