What are things need to run php code ? How to run a php code,Full Procedure


To run php we need first of all a server on which the php script runs.
For offline mode ,we recommend you to use WAMP SERVER
Install WAMP SERVER
 

When the Wamp server has been install then go to;
·         C Partition
·         Then Wamp Folder
·         Then www Folder
i.e   C:\wamp\www

ü  ‘C:\wamp\www’ Here you will save you will save the PHP files  .
ü  Run wamp server
Then open http://localhost/phpmyadmin/  in the browser .
ü  Create Database and Table..
Then create a php file in..
ü  C:\wamp\www
Create Database connection and server connection like as below,
<?php


mysql_connect('localhost','root',' ');
mysql_select_db('database_name');

echo 'Hello Worlds';

?>





How this Code Work:
mysql_connect() has three parameters
ü  ServerName
ü  Username
ü  Password
mysql_connect('ServerName','UserName',' Password');
mysql_select_db() has one parameter
mysql_select_db('databaseName');
echo 'Hello Worlds';
                                       is use to print Hello Worlds  on the screen…