PHP

PHP-Examples

Here are some basic programs using PHP 1. Arithmetic operation program using PHP <?php $str=” Arithmetic operation”; $a=4; $b=5; $c=$a+$b; echo “Sum=”, $c; $c=$a-$b; echo “<br>Sub=”, $c; $c=$a*$b; echo “<br>Mul=”, $c; $c=$a/$b; echo “<br>Div=”, $c; ?> 2. PHP program to print person name and age. <?php $name=”John”; $age=20; echo “Person name=”, $name; echo “<br>Age=”, $age; […]

Share

PHP-Examples Read More »

PHP

PHP = Pre-processor Hypertext PHP, a server side scripting languages widely (nearly 82% of the worlds websites are developed using PHP!) used in developing dynamic and interactive webpages. Advantages of PHP ——Dynamic content. —Computational capability. —Database and file system access. —Network access (from the server only). —Built-in libraries and functions. —Known platform for execution (as opposed

Share

PHP Read More »

PHP-Database Programs

Following are the various PHP  programs to demonstrate Database  connections. 1. PHP Program to demonstrates whether the connection to mysql database is active or not. <?php $dbhost = ‘localhost’; $dbuser = ‘root’; $dbpass = ”; $db = ‘mars_db’; $conn = mysql_connect($dbhost,$dbuser,$dbpass); if (!$conn) { die(‘Could not connect: ‘ . mysql_error()); } else { echo ‘Connected

Share

PHP-Database Programs Read More »

Share
Scroll to Top