Posts

Showing posts with the label PHP

PHP simple login script

Image
Hi dear friends, we have discussed about d eleting a file using PHP script  in our previous tutorial. In this tutorial I am going to explain you about login script using PHP. Login is used in applications where a user needs to be authenticated to access an application. This tutorial will give you the basic login form. I have used  MySql  to  connect to the database  where the login details are stored. I have three PHP files where the first file contains the login form, the second contains the process for login form and the third file is the one where you will be redirected after login is successful. Now let us see these files and let me explain them in detail. Please follow these carefully. login.php As I said there are three files. Login.php is the first file that contains login form. Let us see the code for it. login.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmln...

How to connect MySQL Database using PHP

 We have seen how to  fetch youtube videos using simple javascript  in our previous tutorial. Today's tutorial is about connecting our database using PHP. Since PHP is a dynamic scripting language and it uses mysql database in the back end to store the data. That means the php file has to be configured to connect the database. This can be done very easily with a simple php code. This tutorial will help you to connect to the database. The database connection needs four parameters to be passed into two functions.  mysql_connect () and  mysql_select_db () are the two functions to connect to the database. mysql_connect () function requires three parameters and this function is used to connect to the database. and  mysql_select_db () function is used to select the database. Here is the simple code that you can simply copy and use to connect your database with php. <?php $dbhost                 ...