PHP MySQL Update

November 12th, 2010 by aBisona 
The UPDATE statement is used to modify data in a table. Update Data In a Database The UPDATE statement is used to update existing records in a table. Syntax UPDATE table_name SET column1=value, column2=value2,… WHERE some_column=some_value Note: Notice the WHERE clause in the UPDATE syntax. The WHERE clause specifies which record or records that should be updated. If you omit the WHERE clause,...

PHP MySQL Order By Keyword

November 12th, 2010 by aBisona 
The ORDER BY keyword is used to sort the data in a recordset. The ORDER BY Keyword The ORDER BY keyword is used to sort the data in a recordset. The ORDER BY keyword sort the records in ascending order by default. If you want to sort the records in a descending order, you can use the DESC keyword. Syntax SELECT column_name(s) FROM table_name ORDER BY column_name(s) ASC|DESC To learn more about SQL,...

PHP MySQL The Where Clause

November 12th, 2010 by aBisona 
The WHERE clause is used to filter records. The WHERE clause The WHERE clause is used to extract only those records that fulfill a specified criterion. Syntax SELECT column_name(s) FROM table_name WHERE column_name operator value To learn more about SQL, please visit our SQL tutorial. To get PHP to execute the statement above we must use the mysql_query() function. This function is used to send...

PHP MySQL Select

November 12th, 2010 by aBisona 
The SELECT statement is used to select data from a database. Select Data From a Database Table The SELECT statement is used to select data from a database. Syntax SELECT column_name(s) FROM table_name To learn more about SQL, please visit our SQL tutorial. To get PHP to execute the statement above we must use the mysql_query() function. This function is used to send a query or command to a MySQL...

PHP MySQL Insert Into

November 12th, 2010 by aBisona 
The INSERT INTO statement is used to insert new records in a table. Insert Data Into a Database Table The INSERT INTO statement is used to add new records to a database table. Syntax It is possible to write the INSERT INTO statement in two forms. The first form doesn’t specify the column names where the data will be inserted, only their values: INSERT INTO table_name VALUES (value1, value2,...

PHP MySQL Create Database and Tables

November 12th, 2010 by aBisona 
A database holds one or multiple tables. Create a Database The CREATE DATABASE statement is used to create a database in MySQL. Syntax CREATE DATABASE database_name To learn more about SQL, please visit our SQL tutorial. To get PHP to execute the statement above we must use the mysql_query() function. This function is used to send a query or command to a MySQL connection. Example The following...

PHP MySQL Connect to a Database

November 12th, 2010 by aBisona 
The free MySQL database is very often used with PHP. Create a Connection to a MySQL Database Before you can access data in a database, you must create a connection to the database. In PHP, this is done with the mysql_connect() function. Syntax mysql_connect(servername,username,password); Parameter Description servername Optional. Specifies the server to connect to. Default value is “localhost:3306″ username Optional....

PHP MySQL Introduction

November 12th, 2010 by aBisona 
MySQL is the most popular open-source database system. What is MySQL? MySQL is a database. The data in MySQL is stored in database objects called tables. A table is a collections of related data entries and it consists of columns and rows. Databases are useful when storing information categorically. A company may have a database with the following tables: “Employees”, “Products”,...

PHP Filter

November 12th, 2010 by aBisona 
PHP filters are used to validate and filter data coming from insecure sources, like user input. What is a PHP Filter? A PHP filter is used to validate and filter data coming from insecure sources. To test, validate and filter user input or custom data is an important part of any web application. The PHP filter extension is designed to make data filtering easier and quicker. Why use a Filter? Almost...

PHP Exception Handling

November 12th, 2010 by aBisona 
Exceptions are used to change the normal flow of a script if a specified error occurs What is an Exception With PHP 5 came a new object oriented way of dealing with errors. Exception handling is used to change the normal flow of the code execution if a specified error (exceptional) condition occurs. This condition is called an exception. This is what normally happens when an exception is triggered: The...

PHP Error Handling

November 12th, 2010 by aBisona 
The default error handling in PHP is very simple. An error message with filename, line number and a message describing the error is sent to the browser. PHP Error Handling When creating scripts and web applications, error handling is an important part. If your code lacks error checking code, your program may look very unprofessional and you may be open to security risks. This tutorial contains...

PHP Secure E-mails

November 12th, 2010 by aBisona 
There is a weakness in the PHP e-mail script in the previous chapter. PHP E-mail Injections First, look at the PHP code from the previous chapter: <html> <body> <?php if (isset($_REQUEST['email'])) //if “email” is filled out, send email { //send email $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail(“someone@example.com”,...