PHP/MySQL vs HTML/CSS: What’s the difference and how do they fit together?

Making your first website by dragging and dropping in Dreamweaver is great, but as you progress into the online marketing world, you eventually need to take it to the next level.  A lot of Internet newbies get confused with all the different coding languages out there.  HTML?  PHP?  When you Google any of them, you’re bombarded with tutorials.  However, these are pointless if you have no idea what purposes the different coding languages even serve.

Let me give you a practical rundown so you can get started on your journey to mad Internet money.

HTML/CSS

Basically, HTML is the code that makes up the look of a website.  Most of what you physically see in the browser when you visit a website is produced with HTML code.  Your browser looks at the HTML source code and displays it as it’s programmed to do.

Next, you have CSS, which basically “aids” the HTML. CSS gives us more control over the way our HTML is displayed. With CSS, we can be more specific with our code declarations.  Where HTML only allows us to put a border around something and choose its color, CSS allows us to choose its width, color, style, and whether it shows right, left, top, or bottom. Get the idea?  CSS simply allows us to take HTML much further.  They are a pair and work great together.

PHP/MySQL

PHP is what we refer to as a server-side programming language.  PHP and MySQL allow us to create dynamic websites – meaning that the website has user functionality.  An example of this would be your websites having members that can login with a username and password.  This is dynamic.  Don’t let that jargon confuse you.  It’s really not that complicated.

A website works by having files on a web server.  PHP is “server-side” because it gives commands for things to be executed on your web server.  This is different from how HTML works, as HTML is simply read by your browser and displays the website.  No changes are being made over on your web server when the HTML code is displayed.

When we talk about MySQL, we’re talking about a database that stores information.  This is necessary for a dynamic website to work.  There needs to a be a database.  If you have a website with members, where else would all the usernames and passwords be stored?

How does it all work together?

The MySQL database stores the information.  The PHP code communicates with the database, storing and retrieving information from it.  The HTML/CSS displays the final result to the Internet user. Simple, right?

Let’s look at a basic example.

Say you have a dynamic website with members.  Your members need to login to the website.  So, you have a login form displayed with HTML code to them. They type in their username and password and click ‘submit.’  Now the PHP script sends that login information to the web server.   The PHP script then finds the username in the MySQL database and checks to make sure the password is correct.   When the password is correct, the PHP then sends back the proper HTML code to display to the user.  Now your member sees the message in their browser, “Welcome back, John!”

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

Leave Your Response

You must be logged in to post a comment.