This is pretty much a basic “How to” for making a very basic guestbook that uses a database instead of text. I go over everything from making the database to the table, the html form and actual posting. If you watch this video you will pretty much see the basic idea of what a guestbook is, how they work, and how to make a basic one yourself.
This video has two parts, so to understand fully, please watch both.
I’ve decided to record how to make complete solutions for a certain problem from a High School programming competition, and the solution for it.
The problem: You are to write a program which will input a positive integer n and output the number of
divisors of n and the sum of those divisors. (Note: by divisor we mean a positive integer
divisor this includes 1 and n.)
Developers often use the handy features included with databases to create solutions in PHP for what ever needs to be satisfied. Databases have functions like quickly matching data to Identifications, searching large sums of data, holding user information and much more that developers can utilize. There are many ways to use a database, or in this case, to interface with a database. Most databases use a rough standard of a Structured Querying Language, which is like code that the SQL server or application interprets. Read more…
Want to dump your database? This video goes over the export feature of PHPMyAdmin which allows you to create and save file dumps of your database. You can use these dumps to make a duplicate database or update a pre-existing database. Or simply to backup regularly in case of database failure. I also marginally go over importing and how to import.
I hope everyone has a great new years day in 2010!
And on the side note, the editor I use is called Komodo Edit. It is Free! http://www.activestate.com/komodo_edit/
In this tutorial I go over deleting rows, not only in PHPMyAdmin, but in PHP as well. Once rows are deleted, they are not coming back. On the side note, it is good to use something that is unique to every row when modifying them or deleting them. Otherwise you can delete anything that matches the name being “orange” and delete two rows. This is why I usually always have an ID field in my rows.
By using PHPMyAdmin, we can first create the result we want to have in our code, and then copy the SQL into PHP and query it with mysql_query($sql). However we need to save the result for further data retrieval. Next, we need to count how many rows there are as an error prevention measure with mysql_num_rows($result), and then find the rows one at a time with mysql_fetch_array($result) within a loop.
Take a look at the source after the jump to see what I mean, or just watch the video.
PHPMyAdmin allows you to easily administer MySQL databases and it can provide the SQL statements used so you can redo what you did in php code.
First, it is important that you have a user to administer the database with, then you can connect to it through PHP. After that, you need to connect to the database, and then select the database that you are going to operate in. After that, you can safely execute your queries. However, to be truely safe, if you are handling variables that you generate, or the user has access to, you will want to use mysql_real_escape_string to protect yourself from SQL Injection.
PHPMyAdmin, a free tool to administer MySQL databases that provides the SQL statements used so you can redo what you did in the web application in php code.