background preloader

PHP and MySQL

Facebook Twitter

PHP/MySQL. Config - PmaWiki. PHP/MySQL Tutorial - Part 2. Introduction Before you actually start building your database scripts, you must have a database to place information into and read it from. In this section I will show you how to create a database in MySQL and prepare it for the data. I will also begin to show you how to create the contacts management database. Database Construction MySQL databases have a standard setup. They are made up of a database, in which is contained tables. Databases And Logins The process of setting up a MySQL database varies from host to host, you will however end up with a database name, a user name and a password.

If you have PHPMyAdmin (or a similar program) installed you can just go to it to log in with your user name and password. Creating A Table Before you can do anything with your database, you must create a table. Creating a table in PHPMyAdmin is simple, just type the name, select the number of fields and click the button. Fields These are just a few of the fields which are available. Fields Part 3. Cookies. Cookies have been around for quite some time on the internet. They were invented to allow webmaster's to store information about the user and their visit on the user's computer. At first they were feared by the general public because it was believed they were a serious privacy risk. Nowadays nearly everyone has cookies enabled on their browser, partly because there are worse things to worry about and partly because all of the "trustworthy" websites now use cookies. This lesson will teach you the basics of storing a cookie and retrieving a cookie, as well as explaining the various options you can set with your cookie.

When you create a cookie, using the function setcookie, you must specify three arguments. Name: The name of your cookie. In this example we will be creating a cookie that stores the user's last visit to measure how often people return to visit our webpage. PHP Code: Don't worry if you can't follow the somewhat involved date calculations in this example. Display: Array_key_exists. News. Tutorials:How jQuery Works. This is a basic tutorial, designed to help you get started using jQuery. If you don't have a test page setup yet, start by creating the following HTML page: The src attribute in the <script> element must point to a copy of jQuery. Download a copy of jQuery from the Downloading jQuery page and store the jquery.js file in the same directory as your HTML file.

To ensure that their code runs after the browser finishes loading the document, many JavaScript programmers wrap their code in an onload function: Unfortunately, the code doesn't run until all images are finished downloading, including banner ads. To run code as soon as the document is ready to be manipulated, jQuery has a statement known as the ready event: For example, inside the ready event, you can add a click handler to the link: Save your HTML file and reload the test page in your browser. For click and most other events, you can prevent the default behavior by calling event.preventDefault() in the event handler: