Wednesday, October 31, 2012

MySQL Tutorials

Create a Connection to a MySQL Database
Before you can access data in a database, you must create a connection to database.
In PHP, this is done with the mysql_connect()

Syntax
Mysql_connect(servername, username, password);

For Example:
$con=mysql_connect(“localhost”,”peter”,”abc123”);
If(!$con){
Die(‘Could not connect:’.mysql_error());
}

?>


Create a Database:
The CREATE DATABASE statement is used to create a database in MySQL.

Syntax:
CREATE DATABASE database_name

Create a Table:

The Create TABLE statment is used to create a table in MySQL.

Syntax:
CREATE TABLE table_name(

column_name1 data_type,
column_name2 data_type,
column_name3 data_type,


)
 

Monday, October 29, 2012

Regular Expression in php

The most wanted Regular Expression. Regular expression examples for decimals input.


Wednesday, October 17, 2012

PHP Array Function


The array functions allow you to manipulate arrays. PHP supports both simple and multi-dimensional arrays. there are also specific functions for populating arrays from database queries.  


The arrays functions are as follows->
sort(), asort(), ksort(), array(), array_chunk(), array_diff(), array_fill(), array_pop(), array_push(), array_search(), array_slice(), array_flip(),array_combine(), array_reserve(),array_walk(),ksort(),uksort(),reset(), rsort(),next(), pos() etc.