File Uploading in PHP
File Uploading is now a requirement of almost every web application. Uploading means tranferring a file from user computer (Client) to the server. While uploading a file, many aspects like file size,file type etc should be considered to make it a secure process.
How to make a Hit Counter using PHP
Hello all! in this post i m going to show you how to make a web hit counter using PHP.It is a very easy and useful hit counter which can display the total number of visits made to your website.In this post you will also learn the file handling capabilities of PHP.Following is the complete code of counter.The file counter.dat is already created on the server, than this file is read and incremented everytime your webpage is requested by a browser.
Simple PHP Gridview
If someone is migrating from ASP.Net to PHP than he must be searching for Gridview kind of funtionality in PHP.Basically this kind of job is accomplished in PHP by populating an HTML table at runtime i.e extracting each row from the database one by one and than build a table dynamically.Following code is doing the same...
Creating a Database from within PHP
Creating a database from the PHP code on runtime is very simple by using a combination of Structured Query Language and the PHP mysql_query() function.
Steps to communicate with MySql database using PHP
If your PHP web application is dealing with a database most commonly MySql,The knowledge about the following functions and their order as described is better.
- mysql_connect(hostname,databaseUserName,databasePassword):This is the first function which will establish a connection with the database.It returns false on connection failure.
- mysql_select_db("databaseName","connectionName"):This function selects the database.It takes database name and connection name as parameter, Note that connection name is optional.This function can also return false in case of any error.
MySql Connect : The mysql_connect() function.
MySql is the database mostly paired with PHP to provide robust functionality of Interactive webpages.To establish any communication with database in MySql, it is necessary to connect with the database.
PHP inlude() Function
If some lines of code are to be included in every page of the website, The PHP include() funciotn works perfect.If you have been working in ASP.Net or in Dreamweaver than you must be familiar with the role of masterpages and frames in ASP.net and Dreamweaver respectively.Suppose if the look and feel of the website has to be kept similar than we can include the navigation and header files on every page using PHP include() function.