Sql Select Distinct

There may be duplicate values in column of table.But we may want to only distinct values from that column. This kind of requirement is fulfilled by DISTINCT. Syntax is as: SELECT DISTINCT(column_name) FROM table_name ...

Read More

Php validation class

Client side validation is done with javascript , but for robust application we should perform sever side validation as well. It makes php application more secure and reliable. Here a php validation class is given with static methods. You can include ...

Read More

php class for mysql database manipulation

Here, this is a php class for manipulating mysql database and executing queries. For beginners this very useful. Include this file in your project and call this class by creating object. Here is class : <?php class Db { protected ...

Read More

Php random string or number tutorial

There are some occasions, when we need a random string. For example when we want to generate password or we want to send verification code or captcha code etc. For generating random string with php, we shall make a function getRandom(), you may use a ...

Read More

Difference between two dates in php

For calculating difference between two dates in php we are make two functions, getDiff and its helping function daysInMonth,getDiff returns difference in array and daysInMonth returns days in month of given year and they are as follow: <?php ...

Read More

Select Option from mysql database

For making select options from mysql database, we make table with name "countries" in mysql database and fill some names as given blow. id country 1 Afg ...

Read More

php mysql_fetch_row

In php mysql_fetch_row() function returns result in a numerical array corresponding to the fetched rows.Offset 0,1 and 2 etc. are used for first column,2nd column and 3rd column etc. respectively.If there are no rows it returns FALSE.As in example w ...

Read More

php mysql fetch array

In php mysql_fetch_array() function returns result in array corresponding to the fetched rows,if there are no rows it returns FALSE.As in example we have table employees in mysql database. id first_name ...

Read More

Php form for inserting records in mysql table

For inserting records with php in mysql table, we need html form, at least one table in mysql. So according to our need, make table with name employees which has three fields id,first_name and lastname as: Create Table employees ( id int NOT NUL ...

Read More

Php is dir function

In php is_dir() function checks whether directory exists or not.Directory's full path is given as an argument. If Directory exists, it returns true otherwise false. Example: <php $path="C:\\Documents and Settings\\user1\\My Document ...

Read More