djdj - HTMLify profile

djdj
471 Files
103208 Views
Latest files of /djdj/php/Programs
<?php
// Connecting to the Db
$servername = "localhost";
$username = "root";
$password = "";
$database = "form";
// Connecting to the Db
$servername = "localhost";
$username = "root";
$password = "";
$database = "form";
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<?php
$name = "Dj"; //String
$salary = 5000000; //Interger
$experience = 1.5; //Float
$bonus = "50.25k";//Decimal
$bollean = true; //Bollean (true or false)
$friends = array('Shubh','ABH','Mohit','Happy','TK');
$name = "Dj"; //String
$salary = 5000000; //Interger
$experience = 1.5; //Float
$bonus = "50.25k";//Decimal
$bollean = true; //Bollean (true or false)
$friends = array('Shubh','ABH','Mohit','Happy','TK');
<?php
/*Operators
1. Arithmetic Operator
2. Assignment Operator
3. Comparison Operator
4. Logical Operator
*/
$a = 10;
/*Operators
1. Arithmetic Operator
2. Assignment Operator
3. Comparison Operator
4. Logical Operator
*/
$a = 10;
<?php
// foreach loop in php
$arr = array('Apple','Banana','Grapes','Mango');
//this is a simply a for loop that use to print an value of array
for($i = 0; $i < count($arr); $i++){
echo $arr[$i]. "\n";
}
// foreach loop in php
$arr = array('Apple','Banana','Grapes','Mango');
//this is a simply a for loop that use to print an value of array
for($i = 0; $i < count($arr); $i++){
echo $arr[$i]. "\n";
}
<?php
$a = 50; // Global Variable
function paste(){
$a = 10; // Local Variable
echo $a. "\n";
global $a;
echo $a;
$a = 50; // Global Variable
function paste(){
$a = 10; // Local Variable
echo $a. "\n";
global $a;
echo $a;
<?PhP
// php is case insensitive programming lang.
//with three variable
$a = 10;
$b = 5;
$c = $a + $b;
EcHo ($c);
// php is case insensitive programming lang.
//with three variable
$a = 10;
$b = 5;
$c = $a + $b;
EcHo ($c);
<?php
// Connecting to the Db
$servername = "localhost";
$username = "root";
$password = "";
$database = "form";
// Connecting to the Db
$servername = "localhost";
$username = "root";
$password = "";
$database = "form";
<?php
//for loop
for ($i=0; $i <= 10; $i++) {
echo $i;
}
?>
//for loop
for ($i=0; $i <= 10; $i++) {
echo $i;
}
?>
<?php
//for connection to database
$servername = "localhost";
$username = "root";
$password = "";
$database = "sabkacode";
//for connection to database
$servername = "localhost";
$username = "root";
$password = "";
$database = "sabkacode";
<?php
$add = false;
$update = false;
$delete = false;
// Connecting to the Db
$servername = "localhost";
$username = "root";
$add = false;
$update = false;
$delete = false;
// Connecting to the Db
$servername = "localhost";
$username = "root";
<?php
$name = "Dj";
echo "This is $name";
/*
1. start with a $ sign.
2. cannot satrt with a number.
3. must start with a letter or an-underscore char.
$name = "Dj";
echo "This is $name";
/*
1. start with a $ sign.
2. cannot satrt with a number.
3. must start with a letter or an-underscore char.
<?php
echo "Hello World!";
?>
<!--
For embedding/use PHP we have to use <?php ?>
all the php code will goes within the <?php /*code*/ ?>
echo "Hello World!";
?>
<!--
For embedding/use PHP we have to use <?php ?>
all the php code will goes within the <?php /*code*/ ?>
<?php
//do while loop
$a = 0;
do {
echo $a;
$a++;
} while ($a <= 10);
?>
//do while loop
$a = 0;
do {
echo $a;
$a++;
} while ($a <= 10);
?>
<?php
//Database Connection
/*There are two ways to connect to My SQL Database
1. MySQLi extension (for use only mysql db)
2. PDO (for use any db)
*/
//Database Connection
/*There are two ways to connect to My SQL Database
1. MySQLi extension (for use only mysql db)
2. PDO (for use any db)
*/
<?php
//while loop
$i = 1;
while($i<=10){
echo $i. "\n";
$i++;
}
?>
//while loop
$i = 1;
while($i<=10){
echo $i. "\n";
$i++;
}
?>
<?php
//Function in php
$ram = [90, 88, 85, 95, 91];
$sum = marks($ram); // function call
$ave = avera($ram);// again call function
echo "Total marks scored by Ram out of 500 is: $sum";
echo "\nAverage of Ram marks is: $ave";
//Function in php
$ram = [90, 88, 85, 95, 91];
$sum = marks($ram); // function call
$ave = avera($ram);// again call function
echo "Total marks scored by Ram out of 500 is: $sum";
echo "\nAverage of Ram marks is: $ave";
<?php
//for connection to database
$servername = "localhost";
$username = "root";
$password = "";
//create connection
//for connection to database
$servername = "localhost";
$username = "root";
$password = "";
//create connection
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST'){//if (isset($_POST)){
$name = $_POST['name'];
$email = $_POST['email'];
echo "welcome" .$name ."". $email;
}
?>
if($_SERVER['REQUEST_METHOD'] == 'POST'){//if (isset($_POST)){
$name = $_POST['name'];
$email = $_POST['email'];
echo "welcome" .$name ."". $email;
}
?>
<?php
// Connecting to the Db
$servername = "localhost";
$username = "root";
$password = "";
$database = "form";
// Connecting to the Db
$servername = "localhost";
$username = "root";
$password = "";
$database = "form";
<?php
$name = 'SabkaCode';
echo $name; //simple print name
echo "\n";
echo "The length of string ".strlen($name)."\n"; // print the length of the string
echo "The reverse string is ".strrev($name)."\n"; //print the string in reverse
echo "The position of a character is ".strpos($name,"e")."\n";// print the position of that char that you write there and search
$name = 'SabkaCode';
echo $name; //simple print name
echo "\n";
echo "The length of string ".strlen($name)."\n"; // print the length of the string
echo "The reverse string is ".strrev($name)."\n"; //print the string in reverse
echo "The position of a character is ".strpos($name,"e")."\n";// print the position of that char that you write there and search
<?php
//dates in php
echo date("d"). "\n"; //Print date of today : 24
echo date("j"). "\n"; //Print date of today : 24
echo date("l"). "\n"; //Print day of today : Saturday
echo date("D"). "\n"; //Print day of today : Sat
echo date("S"). "\n"; //Print th of today : TH
//dates in php
echo date("d"). "\n"; //Print date of today : 24
echo date("j"). "\n"; //Print date of today : 24
echo date("l"). "\n"; //Print day of today : Saturday
echo date("D"). "\n"; //Print day of today : Sat
echo date("S"). "\n"; //Print th of today : TH
<?php
//Numeric Array or Index Array
$arr = array('ram','shiv','kumar','arjun');
echo $arr[0];
echo $arr[1];
//using array for loop
for($i = 0; $i < count($arr); $i++){
//Numeric Array or Index Array
$arr = array('ram','shiv','kumar','arjun');
echo $arr[0];
echo $arr[1];
//using array for loop
for($i = 0; $i < count($arr); $i++){
<?php
$age = 30;
switch($age){
case 18:
echo "You are eligible for vote\n";
break;
case 12:
echo "your age is 12\n";
$age = 30;
switch($age){
case 18:
echo "You are eligible for vote\n";
break;
case 12:
echo "your age is 12\n";
<?php
$a = 5;
$b = 2000;
$c = 2016;
if($a > 2){
echo "a is greater than 2\n";
}
$a = 5;
$b = 2000;
$c = 2016;
if($a > 2){
echo "a is greater than 2\n";
}
<?php
//for connection to database
$servername = "localhost";
$username = "root";
$password = "";
$database = "sabkacode"; //already created db
//for connection to database
$servername = "localhost";
$username = "root";
$password = "";
$database = "sabkacode"; //already created db
<?php
if($_SERVER['REQUEST_METHOD'] == 'GET'){//if (isset($_GET)){
$name = $_GET['name'];
$email = $_GET['email'];
echo "welcome" .$name ."". $email;
}
?>
if($_SERVER['REQUEST_METHOD'] == 'GET'){//if (isset($_GET)){
$name = $_GET['name'];
$email = $_GET['email'];
echo "welcome" .$name ."". $email;
}
?>
<?php
//Multi Dieminsion Array
$md = array(
array(2,5,7,8),
array(1,2,3,1),
array(5,6,7,2));
echo var_dump($md); //for simple see thae array it gives all values of array
//Multi Dieminsion Array
$md = array(
array(2,5,7,8),
array(1,2,3,1),
array(5,6,7,2));
echo var_dump($md); //for simple see thae array it gives all values of array
<?php
echo"Include:<br>";
//include
include 'MySQL-Databases-Connection.php'; //include will only produce a warning (E_WARNING) and the script will continue
$sql = "SELECT * FROM `details` ";
$result = mysqli_query($conn, $sql);
echo"Include:<br>";
//include
include 'MySQL-Databases-Connection.php'; //include will only produce a warning (E_WARNING) and the script will continue
$sql = "SELECT * FROM `details` ";
$result = mysqli_query($conn, $sql);
<?php
//for read the file
readfile('yoursfile.txt'); //for only read the file
echo readfile('yoursfile.txt'); //for read the file and print how many word in the file
//fopen - is used to open the file
//fread - is used to read the file
//fclose - is used to close the file
//for read the file
readfile('yoursfile.txt'); //for only read the file
echo readfile('yoursfile.txt'); //for read the file and print how many word in the file
//fopen - is used to open the file
//fread - is used to read the file
//fclose - is used to close the file