Sunteți pe pagina 1din 2

AAST Computer 2010/2011

Engineering
Mohamed Nasr Hagras

PHP-MYSQL
Connection
PHP is a powerful tool for making dynamic and interactive Web pages.
PHP is the widely-used, free, and efficient alternative to competitors such as Microsoft's
ASP.
What is PHP?

• PHP stands for PHP: Hypertext Preprocessor


• PHP is a server-side scripting language, like ASP
• PHP scripts are executed on the server
• PHP supports many databases (MySQL, Informix, Oracle, Sybase,
Solid, PostgreSQL, Generic ODBC, etc.)
• PHP is an open source software
• PHP is free to download and use

What is a PHP File? • MySQL supports standard SQL


• MySQL compiles on a number
• PHP files can contain text, of platforms
HTML tags and scripts • MySQL is free to download and
• PHP files are returned to the use
browser as plain HTML
• PHP files have a file extension PHP + MySQL
of ".php", ".php3", or ".phtml"
• PHP combined with MySQL are
What is MySQL? cross-platform (you can develop
in Windows and serve on a Unix
• MySQL is a database server platform)
• MySQL is ideal for both small
and large applications

Why PHP?
• PHP runs on different platforms (Windows, Linux, Unix, etc.)
• PHP is compatible with almost all servers used today (Apache, IIS, etc.)
• PHP is FREE to download from the official PHP resource: www.php.net
• PHP is easy to learn and runs efficiently on the server side
How to install php
LEARN MORE:
Download PHP for free here:
http://www.php.net/downloads.php
Using our
powerfull blog
Download MySQL for free here:
http://www.mysql.com/downloads/

Download Apache for free here:


http://httpd.apache.org/download.cgi
Create a Connection to a The connection will be closed
MySQL Database automatically when the script
ends. To close the connection
before, use the mysql_close()
Before you can access data in a
function:
database, you must create a
connection to the database.
What is MySQL?
<?php
MySQL is a database.
$con =
The data in MySQL is stored in In PHP, this is done with the Tutorials and videos updated
mysql_connect("localhost","peter
database objects called tables. mysql_connect() function. every day to help you through
","abc123");
A table is a collections of related web design and develop
if (!$con)
data entries and it consists of Syntax solutions.
{
columns and rows.
Databases are useful when storing mysql_connect(servername,us die('Could not connect: ' . Just visit:
information categorically. A ername,password); mysql_error()); http://the-d-house.blogspot.com/
company may have a database }
with the following tables: Closing a Connection
"Employees", "Products", // some code
"Customers" and "Orders".
mysql_close($con);
?>

S-ar putea să vă placă și