Sunday, 3 July 2016

on Leave a Comment

PHP Data Type in integer

PHP Data Type 


Variable can store of Different types, and data types can do different things.

PHP supports the following data type :

1.string
2.Integer
3.float
4.Boolean
5.Array
6.Object
7.Null
8.Resource

An integer is a whole number (without decimals).  It is a number between -2,147,483,648 and +2,147,483,647.

Rules for integers:

    *An integer must have at least one digit (0-9)
    *An integer cannot contain comma or blanks
    *An integer must not have a decimal point
    *An integer can be either positive or negative
    *Integers can be specified in three formats: decimal (10-based), hexadecimal (16-based - prefixed         with 0x) or octal (8-based - prefixed with 0)


Now , I will teach you ...... integer

There are below more Example 



# For Example : 1


<?php

$a = 10;

echo $a."<br>";

$c = 20;
$c += 30;

echo $c ."<br>";

$z =2;
echo $z *=5;

echo "<br>";

$x = 11;

$b = ++$x;

echo $b;



?>



You can see below Video Tutorial






on Leave a Comment

PHP data type in string

PHP Data Type


Variable can store of Different types, and data types can do different things.

PHP supports the following data type :

1.string
2.Integer
3.float
4.Boolean
5.Array
6.Object
7.Null
8.Resource


Now , I will teach you ...... String

There are below more Example :


# For Example : 2


<?php

//echo "<input type = "text" name = "name" value = "1name">";

echo '<input type = "text" name = "name" value = "2name">';

echo "<input type = 'text' name = 'name' value = '3name'>";

echo "<input type = \"text\" name = \"name\" value = \"4name\">";


?>





# For Example :2



<?php

echo "what's your name?<br>";
echo 'what\'s your father name?';

?>



# For Example :3





<?php

$a = "raju";

echo "<br>$a <br>";


$b = "mim";

echo $b."<br>";


$c = "come";

echo "$c"."<br>";


$d = "salraj";
$e = "khan";

echo $d.$e."<br>";




$d = "raju";
$e = "khan";

echo $d." ".$e."<br>";


$d = "mim";
$e = "priyanka";

echo $d."<br>".$e;
?>



# For Example :4



<?php

$na = "may name is";

echo "{$na}Raju";

?>



You can see below Video Tutorial






Thursday, 26 May 2016

on Leave a Comment

PHP supper Global variable vedio tutorial($_COOKIE)-part-1

PHP supper Global variable vedio tutorial($_COOKIE)-part-1

<!--Now,I will teach you  $_COOKIE
Supper_GLOBAL_Variable

$GLOBALS
$_SERVER
$_REQUEST
$_POST
$_GET
$_FILES
$_ENV
$_COOKIE
$_SESSION
 -->



1.Q.    What is $_COOKIE ?


A Cookie is often used to identify a user . With PHP you can create and store this user data into cookies by using the $_COOKIE Superglobal variable. In this example we will go over how to setup a cookie (using setcookie(name, value, expire, path, domain);) and request the data later with $_COOKIE.

A cookie is created with the setcookie() function.

Syntax :

setcookie(name, value, expire, path, domain, secure, httponly);


Note: The setcookie() function must appear Before the <html> tag.


Example #1:

<?php

setcookie("user",date("m-d-y"),time()+86400*30 );

echo $_COOKIE['user'];

?>

Output : 
             5-26-2016



Example #2:

<?php

setcookie("user","salraj",time()+60*60*24*30 );

echo $_COOKIE['user'];

?>

Output : 
         salraj



Note:

time() + 60(second) * 60(minute) * 24(hour) *30(day)
                                      or
time() + 50 (day)
                                       or



time() + 86400*30 

I mean that 86400 = 1 Day So, 86400 *30  = 30 Day  


I will see real project . I use $_COOKI  . So our need two page .

setcookie.php


<?php
setcookie("user","salraj",time()+60*60*24*30);

?>

<html>
<head></head>
<body>
<h3>Sending a Cookie</h3>
<form action = "cooike.php" method = "post">
<input type = "submit" name = "submit" value = "sent cookie">
<form>

</body>
</html>



cookie.php

l>
<head>
</head>
<body>

<?php

if($_COOKIE['user1']){
echo "You user name is ".$_COOKIE['user'];;
}
else{
echo "You haven't user name !";
}

?>


</body>
</html>



You can watch PHP supper Global variable vedio tutorial($_COOKIE)-part-1










Thursday, 19 May 2016

on Leave a Comment

PHP supper Global variable vedio tutorial($_SESSION)-part-2



PHP supper Global variable vedio tutorial($_SESSION)-part-2


A PHP session allows you to store user information on the server for lateruse like a username or shopping cart items. Note that this is only for temporary use as the session expiresonce the site is exited.

Now,I will see  login-logout system.Our need

Start a PHP Session

A session is started with the session_start() function.

Destroy a PHP Session

To remove all global session variables and destroy the session, use session_unset()
 and session_destroy():


Our need Three file .

1) set.php  2) view.php  3)  unset.php



set.php



<?php
session_start();

$_SESSION['user'] = "raju";
$_SESSION['age'] = 23;


?>


 view.php




<?php
session_start();
if(isset($_SESSION['user']) && isset($_SESSION['age'])){
echo "User name is : " . $_SESSION['user'] ."<br>"."and age is : " .$_SESSION['age'];
}
else{
echo "Please Login your account !";
}

?>



unset.php



<?php
session_start();
session_destroy();

//unset($_SESSION['user']);
//unset($_SESSION['age']);

?>


You can watch PHP supper Global variable vedio tutorial($_SESSION)-part-2













on 1 comment

PHP supper Global variable vedio tutorial($_SESSION)-part-1


7.PHP supper Global variable vedio tutorial($_SESSION)-part-1



A PHP session allows you to store user information on the server for lateruse like a username or shopping cart items. Note that this is only for temporary use as the session expiresonce the site is exited.



A session is started with the session_start() function.
Session variables are set with the PHP global variable: $_SESSION.

For Example :

<?php
session_start();
echo $_SESSION['name'] = "Salraj";

?>

Output : salraj



You can watch

PHP supper Global variable vedio tutorial($_SESSION)-part-1








Written By Salraj khan Raju . Powered by Blogger.