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
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 :
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 ...
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:
For making select options from mysql database, we make table with name "countries" in mysql database and fill some names as given blow.
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 ...
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.
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 ...
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.
$path="C:\\Documents and Settings\\user1\\My Document ...