Thursday 24 May 2012

Static Scope variable



When a function is completed, all of its variables are normally deleted. However, sometimes you want a local variable to not be deleted.
To do this, use the static keyword when you first declare the variable:
static $rememberMe;
Then, each time the function is called, that variable will still have the information it contained from the last time the function was called.
Note: The variable is still local to the function.

What do you Need?



If your server supports PHP you don't need to do anything.
Just create some .php files in your web directory, and the server will parse them for you. Because it is free, most web hosts offer PHP support.
However, if your server does not support PHP, you must install PHP.
Here is a link to a good tutorial from PHP.net on how to installPHP

php:how to start


PHP + MySQL

  • PHP combined with MySQL are cross-platform (you can develop in Windows and serve on a Unix platform)

Why PHP?

  • PHP runs on different platforms (Windows, Linux, Unix, etc.)
  • PHP is compatible with almost all servers used today (Apache, IIS, etc.)
  • PHP is FREE to download from the official PHP resource: www.php.net
  • PHP is easy to learn and runs efficiently on the server side

Where to Start?

To get access to a web server with PHP support, you can:
  • Install Apache (or IIS) on your own server, install PHP, and MySQL
  • Or find a web hosting plan with PHP and MySQL support

What is MySQL?



  • MySQL is a database server
  • MySQL is ideal for both small and large applications
  • MySQL supports standard SQL
  • MySQL compiles on a number of platforms
  • MySQL is free to download and use

What is a PHP File?



  • PHP files can contain text, HTML tags and scripts
  • PHP files are returned to the browser as plain HTML 
  • PHP files have a file extension of ".php", ".php3", or ".phtml"

Friday 27 April 2012

how to set cookie in php


The below code to give to set cookies in any side .it can store a txt file as a url address.


for example when u select remember with a use of password it will store as a txt file.

<?phpsetCookie("user","a1",time()+3600);?>

application in php


<html>
<head>
<style>
p{
text-decoration:blink;
color:white;
font-size:30;
}
</style>
</head>
<body  bgcolor="orange">
<form action="calulator.php" method="post">
<marquee bgcolor="orange" behaviour="slide" height="30" ><font color="white"><b><a href="login.html">Welcome for Registation</a></b></font></marquee>
<p><b>Calculator</b></p>
<table border="2" align="center" bgcolor="red" height="300" width="400">
<br/><br/><br/><br/><tr><td align="right"><font color="white">Enter N:</font></td><td><input type="text" name="n1"></td></tr>
<tr><td  align="right"><font color="white">Enter N:</font></td><td><input type="text" name="n2"></td></tr>
<tr><td  align="right"><select name="n3">
<option>sum</option>
<option>difference</option>
<option>multiple</option>
<option>devision</option>
</select></td>
<td><input type="submit" value="ok"></td></tr>
<tr><td  align="right"><p>The answer is:</p></td><td><?php
$a=$_POST["n1"];
$b=$_POST["n2"];
$c=$_POST["n3"];


 if($c=='sum')
{
$d=$a+$b;
echo "<font color='white'size='10'><b><p>".$d."</font></b></p>";
}
else if($c=='difference')
{
$d=$a-$b;
echo "<p><font color='white'size='10'><b>".$d ."</p></font></b>";
}
else if($c=='multiple')
{
$d=$a*$b;
echo "<p><font color='white'size='10'><b>".$d."</p></font></b>";
}
else if($c=='devision')
{
if($b!='0 ')
{
$d=$a/$b;
echo "<p><font color='white'size='10'><b>".$d."</p></font></b>";
}
else  
echo "Number is not divide by zero";
}


?>
</td></tr>


</form>
</html>