Getting Started with Php, Ajax, Jquery
Basic php
Lets set the php development environment LAMP, Install
WampServer2.0i.exe Once you install WampServer2, you are ready to run a php file on browser,
Once you are ready with php-mysql envionment you might have few basic questions, Here i am trying to put all questions and answers together.
Php is simply fun ! easy ..but yes more you do ..more you become expert.
 | Include file in php |
| <?php include("header.php"); ?>
| | 1:
| | 2:<?php include("footer.php"); ?>
| | 3: |
|
 | Cookie and Session in php |
| <?php
| | 1:// Setting and Reading Cookie
| | 2:$value = 'Here i am setting my cookie values';
| | 3:
| | 4:setcookie("TestCookie", $value, time()+3600);
| | 5:
| | 6:echo $_COOKIE["TestCookie"];
| | 7:
| | 8:?>
| | 9:
| | 10:Now we see how to use session in php.
| | 11:
| | 12:Wherever you want to use session, you need to place the following line before <html> tag start.
| | 13:
| | 14:<?php session_start(); ?>
| | 15:
| | 16:Now setting value in session
| | 17:
| | 18:<?php
| | 19:$_SESSION['username']=$_POST['username'];
| | 20:?>
| | 21:
| | 22:Reading value from session
| | 23:<?php
| | 24:echo "<b>".$_SESSION['username'] . "</b>";
| | 25:?>
| | 26: |
|
 | Read data from mysql in php |
| <?php
| | 1:$con = mysql_connect("localhost","peter","abc123");
| | 2:if (!$con)
| | 3: {
| | 4: die('Could not connect: ' . mysql_error());
| | 5: }
| | 6:
| | 7:mysql_select_db("my_db", $con);
| | 8:
| | 9:$result = mysql_query("SELECT * FROM Persons");
| | 10:
| | 11:echo "<table border='1'>
| | 12:<tr>
| | 13:<th>Firstname</th>
| | 14:<th>Lastname</th>
| | 15:</tr>";
| | 16:
| | 17:while($row = mysql_fetch_array($result))
| | 18: {
| | 19: echo "<tr>";
| | 20: echo "<td>" . $row['FirstName'] . "</td>";
| | 21: echo "<td>" . $row['LastName'] . "</td>";
| | 22: echo "</tr>";
| | 23: }
| | 24:echo "</table>";
| | 25:
| | 26:mysql_close($con);
| | 27:?>
| | 28: |
|
Asp.net, Ado.net, .Net Remoting, .Net
Webservice, SQL, XML, XSLT, WCF, WPF, WWF NHibernate, Ajax, Jquery, DHTML