Home > Articles > Programming > PHP

  • Print
  • + Share This
This chapter is from the book

Summary

In this hour, we covered some of the basics of storing and retrieving information from a MySQL database.

You should now be able to establish a connection to the MySQL server using mysql_ connect() or mysql_pconnect().

You should be able to select a database with mysql_select_db(). If the selection fails, you should be able to discover more about the error with mysql_error().

You should be able to make SQL queries using mysql_query(). With the result resource this function returns, you should be able to access data, or discover the number of rows you have transformed.

You should be able to use PHP's MySQL functions to list the number of databases, tables, and fields accessible to you and to find out more about the attributes of individual fields.

You should be able to use some of the techniques discussed in the creation of our DataLayer class to automate SQL queries, and to separate database code from a larger script.

In the next hour we will take a look at PHP in the contexts of the wider world. In particular we will be exploring techniques for learning about and talking to machines other than our own.

  • + Share This
  • 🔖 Save To Your Account