Should I Learn PHP and MySQL or Not?
I’ve had quite a few people ask me this question: “Should I learn PHP and MySQL?”.
The answer is never easy. It all depends on what you’re trying to accomplish. Are you looking to be involved in your own website? Is it being run on PHP and MySQL? What would you like to do with your website?
There’s a million questions you can ask yourself. I, personally, believe that anyone who wants to become more involved with their own website or run their own Web Design and Development Company should, at the minimum, learn the basics of PHP and MySQL.
Why should you? Well, let’s take a few examples…
Maybe you want to create a Members are on your site and you want to be able to offer downloads, use a more interactive Contact script, show information dynamically for your customers (i.e. Time and Date, Their personal information, the information they searched for last, Billing information, Download history, username and/or password, etc) to make it easier for them to browse through your site.
Maybe you want to be able to use PHP for your Search Engine Optimization needs? Needs such as 404 Redirects, 301 redirects, etc.
Maybe you need to create a built in search system for your e-commerce site? Maybe you’re looking to simply redirect people to an Affiliate program?
See the many, MANY ways you can use PHP? It’s a very valuable tool to know and understand. Imagine yourself having the knowledge to take a product like Wordpress and fully customize it to your own, personal, needs?
Think you can make money off of one of your Wordpress Plugin Ideas by knowing PHP? Think you can build a better Content Management System than what’s currently available? What about a new Social Networking Script - OR Community?
Companies like PHPFox have made a killing with their php knowledge. Likewise for companies such as Mambo, vBulletin and various other scripts that you can purchase.
So the next question would be HOW you can learn PHP?
There’s a million ways to learn but I try to explain to everybody that watching Videos and DOING the coding practices they ask you to do is how you’ll learn quickly.
Sure… lot’s of people have learned PHP by reading books. But I find the problem with books is a lack of support. You’re always going to learn more by seeing and doing rather than reading and doing. Luckily there are solutions to this problem.
You can also visit popular forums such as Sitepoint, Digitalpoint and other Webmaster related forums or communities that allow other members to help with questions and answers.
No matter what you choose to do - just remember that DOING is how you learn. Practice without reading or watching. Just take the little knowledge you have at the time and make it grow with practice.
I hope you figure out what you need to accomplish and good luck!
What Is MySQL And Does Your Business Need It?
What is MySQL?
First released in May 23, 1995, MySQL is an open source database software. It is part of a large and growing family of open source software including Linux, Apache, and programming languages PHP and Perl. However, unlike many open source products where the copyright is owned by the individual authors or distributors, MySQL is owned and sponsored by a single for-profit firm, MySQL AB, which holds the copyright to most of the codebase. They develop and maintain the system, sell support, service contracts, and proprietary-licensed copies of MySQL.
MySQL is a relationship database, which is a collection of items or tables organized into predefined categories or described tables from which data can be accessed or reassembled in many different ways without having to reorganize the database tables. This format is enormously popular with more than 100 million copies of the software downloaded over the life of MySQL. The popularity stems from the fact that the databases are easy to create and access. Additionally, they are easy to extend, a new data category can be added without requiring that all existing applications be modified.
When creating a relational database, you can not only extend the data, you can define the domain of possible values in a data column and any additional constraints that you want to apply to the value of your data. This makes your information significantly more valuable and user friendly.
Uses of MySQL
There are many uses of MySQL for a business and you can find many significant case studies at http://www.MySQL.com/why-MySQL/case-studies/. Among them are many stories about how information generated from MySQL has saved IT teams thousands of man hours and thousands of dollars.
Here’s an example of how you can use it for your business. Consider a typical order entry database. It might include the following columns for customer information: name, address, and phone number. . Another table might describe an order and have these columns: product, customer, date, and sales price. This table and the relevant information could be used to show a report on all customers that bought products on a specific date. A financial services manager in the same company could, from the same tables, obtain a report on accounts that needed to be paid.
Craigslist uses MySQL to power more than 50 forums, among many other things, and Yahoo Finance uses it to aggregate headlines for its website.
Benefits of MySQL
Ease of use. A basic knowledge of SQL and database manipulation is required however MySQL is logical and easy to use. This means you don’t have to spend as much time and money either training existing staff, or hiring developers.
Security. There are not a lot of databases that can compare to the security that MySQL offers. It includes solid data security layers that protect your sensitive information. Rights can be set to allow some or all privileges to either individuals or groups. Passwords are encrypted. The access to your database can be controlled by a remote machine that can completely control what a user can view. The system can be locked down even more through the operating system.
Capacity and memory. MySQL can handle almost any amount of data from only a few rows to as much as 50 million rows or more. The default file size limit is about 4 GB. It manages memory very well, which means it functions efficiently and speedily without crashing or dumping your information. Additionally, MySQL server has been thoroughly tested to prevent memory leaks.
Unbeatable flexibility. MySQL runs on many operating systems, including Novell NetWare, Windows, Linux, and UNIX
It supports several development interfaces including JDBC, ODBC, and scripting languages including PHP and Perl. This enables you to create database solutions that run on all major operating systems, including Linux, UNIX, and Windows.
More than one person can access business information at a time. This means that a large group of people can access the information at once but there can also be several connections at one time.
Multiple storage engines, or types of table, allow you to choose which one is most effective.
Commit grouping, gathering multiple transactions from multiple connections together to increase the number of commits per second.
Technical support. One of the drawbacks to many open source products is the fact that the support is sometimes nonexistent or slow to respond at best. The products are free or close to free so it’s a trade off. However, MySQL Enterprise offers support itself, including 24/7 30-minute response time and the support team has direct access to the software developers.
Licensing. We’ve already discussed the fact that open source products are extremely cost efficient! MySQL AB makes MySQL Server available as free software, but they also offer the MySQL Enterprise subscription offering for business users and dual-license it under traditional proprietary licensing arrangements for cases where the intended use is incompatible with the General Public License agreement.
Drawbacks of MySQL
Early versions of MySQL lacked many standard relational database management system (RDBMS) features, usually with the goal of trading guaranteed accuracy for speed. Many (but not yet all) such criticisms have been remedied in later versions of the software, including transactions and relational integrity constraints.
Some say that MySQL’s feature list leaves something to be desired, but its fans swear that a scaled-down feature set means you only have to deploy, configure and maintain what you need
There are also a few common errors such as out of memory or packet too large they generally relate to the configuration of the server and are uncommon and the errors are fairly easy to remedy.
Bottom Line:
The uses of MySQL are seemingly endless and for a business the information gathered is priceless. Combined with PHP, it can be used to create dynamic web pages. If you’re using any type of web 2.0 technology like forums, online ordering, subscription forms etc…must utilize a database of some sort to gather and analyze the information. When it comes to database technology, there really isn’t anything that beats MySQL for stability, price, and ease of use.
MemberSpeed Content Management software can run on MySQL 3.23 and above.
Developing A Login System With PHP And MySQL
Most interactive websites nowadays would require a user to log in into the website’s system in order to provide a customized experience for the user. Once the user has logged in, the website will be able to provide a presentation that is tailored to the user’s preferences.
A basic login system typically contains 3 components:
1. The component that allows a user to register his preferred login id and password
2. The component that allows the system to verify and authenticate the user when he subsequently logs in
3. The component that sends the user’s password to his registered email address if the user forgets his password
Such a system can be easily created using PHP and MySQL.
================================================================
Component 1 – Registration
Component 1 is typically implemented using a simple HTML form that contains 3 fields and 2 buttons:
1. A preferred login id field
2. A preferred password field
3. A valid email address field
4. A Submit button
5. A Reset button
Assume that such a form is coded into a file named register.html. The following HTML code excerpt is a typical example. When the user has filled in all the fields, the register.php page is called when the user clicks on the Submit button.
[form name=”register” method=”post” action=”register.php”]
[input name=”login id” type=”text” value=”loginid” size=”20″/][br]
[input name=”password” type=”text” value=”password” size=”20″/][br]
[input name=”email” type=”text” value=”email” size=”50″/][br]
[input type=”submit” name=”submit” value=”submit”/]
[input type=”reset” name=”reset” value=”reset”/] [/form]
The following code excerpt can be used as part of register.php to process the registration. It connects to the MySQL database and inserts a line of data into the table used to store the registration information.
@mysql_connect(”localhost”, “mysql_login”, “mysql_pwd”) or die(”Cannot connect to DB!”); @mysql_select_db(”tbl_login”) or die(”Cannot select DB!”); $sql=”INSERT INTO login_tbl (loginid, password and email) VALUES (”.$loginid.”,”.$password.”,”.$email.”)”; $r = mysql_query($sql); if(!$r) {
$err=mysql_error();
print $err;
exit(); }
The code excerpt assumes that the MySQL table that is used to store the registration data is named tbl_login and contains 3 fields – the loginid, password and email fields. The values of the $loginid, $password and $email variables are passed in from the form in register.html using the post method.
================================================================
Component 2 – Verification and Authentication
A registered user will want to log into the system to access the functionality provided by the website. The user will have to provide his login id and password for the system to verify and authenticate.
This is typically done through a simple HTML form. This HTML form typically contains 2 fields and 2 buttons:
1. A login id field
2. A password field
3. A Submit button
4. A Reset button
Assume that such a form is coded into a file named authenticate.html. The following HTML code excerpt is a typical example. When the user has filled in all the fields, the authenticate.php page is called when the user clicks on the Submit button.
[form name=”authenticate” method=”post” action=”authenticate.php”]
[input name=”login id” type=”text” value=”loginid” size=”20″/][br]
[input name=”password” type=”text” value=”password” size=”20″/][br]
[input type=”submit” name=”submit” value=”submit”/]
[input type=”reset” name=”reset” value=”reset”/] [/form]
The following code excerpt can be used as part of authenticate.php to process the login request. It connects to the MySQL database and queries the table used to store the registration information.
@mysql_connect(”localhost”, “mysql_login”, “mysql_pwd”) or die(”Cannot connect to DB!”); @mysql_select_db(”tbl_login”) or die(”Cannot select DB!”); $sql=”SELECT loginid FROM login_tbl WHERE loginid=’”.$loginid.”’ and password=’”.$password.”’”; $r = mysql_query($sql); if(!$r) {
$err=mysql_error();
print $err;
exit(); } if(mysql_affected_rows()==0){
print “no such login in the system. please try again.”;
exit(); } else{
print “successfully logged into system.”;
//proceed to perform website’s functionality – e.g. present information to the user }
As in component 1, the code excerpt assumes that the MySQL table that is used to store the registration data is named tbl_login and contains 3 fields – the loginid, password and email fields. The values of the $loginid and $password variables are passed in from the form in authenticate.html using the post method.
================================================================
Component 3 – Forgot Password
A registered user may forget his password to log into the website’s system. In this case, the user will need to supply his loginid for the system to retrieve his password and send the password to the user’s registered email address.
This is typically done through a simple HTML form. This HTML form typically contains 1 field and 2 buttons:
1. A login id field
2. A Submit button
3. A Reset button
Assume that such a form is coded into a file named forgot.html. The following HTML code excerpt is a typical example. When the user has filled in all the fields, the forgot.php page is called when the user clicks on the Submit button.
[form name=”forgot” method=”post” action=”forgot.php”]
[input name=”login id” type=”text” value=”loginid” size=”20″/][br]
[input type=”submit” name=”submit” value=”submit”/]
[input type=”reset” name=”reset” value=”reset”/] [/form]
The following code excerpt can be used as part of forgot.php to process the login request. It connects to the MySQL database and queries the table used to store the registration information.
@mysql_connect(”localhost”, “mysql_login”, “mysql_pwd”) or die(”Cannot connect to DB!”); @mysql_select_db(”tbl_login”) or die(”Cannot select DB!”); $sql=”SELECT password, email FROM login_tbl WHERE loginid=’”.$loginid.”’”; $r = mysql_query($sql); if(!$r) {
$err=mysql_error();
print $err;
exit(); } if(mysql_affected_rows()==0){
print “no such login in the system. please try again.”;
exit(); } else {
$row=mysql_fetch_array($r);
$password=$row[”password”];
$email=$row[”email”];
$subject=”your password”;
$header=”from:you@yourdomain.com”;
$content=”your password is “.$password;
mail($email, $subject, $row, $header);
print “An email containing the password has been sent to you”;
}
As in component 1, the code excerpt assumes that the MySQL table that is used to store the registration data is named tbl_login and contains 3 fields – the loginid, password and email fields. The value of the $loginid variable is passed from the form in forgot.html using the post method.
================================================================
Conclusion
The above example is to illustrate how a very basic login system can be implemented. The example can be enhanced to include password encryption and additional functionality – e.g. to allow users to edit their login information.
Used with the author’s permission.
This article is written by John L.
John L is the Webmaster of Designer Banners (http://www.designerbanners.com)
MySQL Web Hosting Package - What To Look For
So your branching out into a MySQL web hosting package and your wondering where to start and which package will best suit your business.
Most MySQL web hosting packages are coupled with PHP, this enables the web designer to create dynamic web sites as opposed to the normal standard text and image web sites you probably have seen every where.
Depending on how much you are willing to spend determines the amount of MySQL databases that you get. If you are just branching out into this area of web site creation then 1 or 2 MySQL databases are enough . Besides its always better to walk before you can run in this business.
If you do not already know then a MySQL is a vendor for the SQL system. SQL stands for Structured Query Language. There are many vendors for SQL like MS Windows, Oracle etc.. MySQL is the most popular open source database server in existence. On top of that, it is very commonly used in conjunction with PHP scripts to create dynamic and powerful server applications.
Remember though when purchasing a MySQL Web hosting package that you find out if the server your MySQL is on is either shared or dedicated.
A shared server limits you to what you can do, for example a MySQL web hosting package that is hosted on a shared server, (by shared I mean used by other web sites also) you may not be able to access your database from anywhere but your own pc.
So if you have the type of business that requires you to be on the move most of the time make sure you have a dedicated server for your MySQL web hosting package. Also a dedicated server means there is less likelihood of the system crashing when you need it most! And of course the extra bandwidth space which comes with your own server.
So make sure you get the right MySQL web hosting package for your business.
Refer Our Web Hosting Guide !