I am learning PHP, and trying to learn mysql. The problem is that I don't get how the two connect. How do I build a database? What does that database hold? How do I connect between other databases? And most importantly, how can php use these databases in a meaningful way?
MySQL is a type of database that is used to store information securely in tables in a way that is easy to control and safely out of the reach of the typical user. PHP has a number of functions used to connect, read, and write information to these database tables. The reason this is useful is for storing vital information about your site that may need to be updated frequently. For example, mysql databases are often used to store user information of people registered on your website. If you were to create your own user login system (as opposed to downloading pre-made ones from the web), you would first have to create the mysql database to store the data. After that, you would create php scripts to connect to your created database and manipulate the data. If for example I wanted a person to be able to register on my site, I would have an html form on my website to gather their information (username, password, etc) and I would create a php script to connect to the database and write the new information as a new row in my user table. I would then be able to create a seperate script to read the data from the database (an example of when this is useful is if I want to check the login information for a user to see if they are registered on the site). There are many applications for holding information in this way. This entire forum holds information in a series of mysql database tables that allow the information for users, posts, forum structure, and more to be stored safely without risk of being manipulated falsely by the everyday user.
Yeah, that makes sense... enough. But I can imagine this becoming cumbersome quickly (if you look at my other threads you can see I'm still having trouble with looping). How long do you think it would take to make a more complex website, considering that I am proficient in html and css? Could you provide example scripts to speed up the process. I would greatly appreciate it. Also, is mysql a language, or just a database tool? I see some sites saying it's a language, but I downloaded the workbench and it really looks similar to something like excel.
It would be greatly helpful if you already proficient with html and css since will php mostly depend on those things especially in web development. Maybe you can consider php framework to speed up such as cakephp or codeigniter eventhough the php.net/manual will always be your best friend. Mysql is a more like a database software/tool which runs at server with its own Structure Query Language flavor. The workbench is one of the mysql client software which accessing the mysql server software in a user friendly way. That's why it has a familiarity with excel tables. Well database consist of tables anyway.
Imagine a mysql table the same way you would an excel table because that is exactly how it is structured. There are commands you can run through mysql in order to tell it how to populate the tables, and like there are tools (like the one you downloaded) that offer simplistic interfaces that will generate the appropriate commands and run them in the background according to what you want. PHP offers a way for you to run the appropriate commands through a website and edit the database. I highly recommend reading through the mysql tutorials on tizag.com since it explains it all in terms of how it would be done in PHP.