Thursday, June 10, 2010

ADD,UPDATE records in PHP



config.php
========================
$dbHost = “localhost”;
$dbUser = “root”;
$dbPassword = “”;
$dbName= “hanzala”;
$con = mysql_connect($dbHost, $dbUser, $dbPassword);
mysql_select_db($dbName, $con);
session_start();
//  echo “
”; print_r($_SESSION);
 exit;
?>
action.php
======================================================================= 
include “config.php”;
if(isset($_POST['submit']) && 
$_POST['submit'] == ‘Register’)
{
$name = $_POST['name'];
$password = $_POST['password'];
$city = $_POST['city'];
$state = $_POST['state'];
$sex = $_POST['sex'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$insert = “INSERT INTO test02 SET empName =
 ‘$name’, empPass = ‘$password’, empCity = ‘$city’, empState = ‘$state’,
 empSex = ‘$sex’ empEmail = ‘$email’, empPhone = ‘$phone’”;
$result = mysql_query($insert);
if($result)
{
header(“Location:newpage.php?msg = 
Registration Completed”);
exit;
}
}
if(isset($_POST['submit']) && 
$_POST['submit'] == ‘Update’)
{
$name = $_POST['name'];
$password = $_POST['password'];
$city = $_POST['city'];
$state = $_POST['state'];
$sex = $_POST['sex'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$queryupdate = “UPDATE test02 SET empName =
 ‘$name’, empPass = ‘$password’, empCity = ‘$city’, empState = ‘$state’,
 empSex = ‘$sex’, empEmail = ‘$email’, empPhone = ‘$phone’”;
$result = mysql_query($queryupdate);
if($result)
{
header(“Location:newpage.php?msg = Update 
Succefully”);
exit;
}
}
if(isset($_POST['submit']) && 
$_POST['submit'] == ‘Login’)
{
$name = $_POST['name'];
$password = $_POST['password'];
$queryLogin = “SELECT * FROM test02 WHERE 
empName = ‘$name’ AND empPass = ‘$password’ “;
$resultLogin = mysql_query($queryLogin);
if(mysql_num_rows($resultLogin) > 0)
{
$row = mysql_fetch_assoc($resultLogin);
$_SESSION['empId'] = $row['empId'];
$_SESSION['empName'] = $row['empName'];
header(“Location: log_success.php”);
exit;
}
else
{
header(“Location: login.php?msg=Login 
Failed”);
}
}
if(isset($_GET['submit']) && 
$_GET['submit'] == ‘logout’)
{
session_destroy();
header(“Location: login.php”);
}
?>

Saturday, April 10, 2010

Father Of Algebra

ABU JA'FAR Mohammed ibn-Musa al-Khwarizmi was born sometime before 800 A.D. and died after 847 A.D. He flourished as a mathematician and astronomer who was a faculty member at the "House of Wisdom" established in Baghdad by Al-Mamun.

Harun al-Rashid became the fifth Caliph of the Abbasid dynasty on 14 September 786, about the time that al-Khwarizmi was born. Harun ruled, from his court in the capital city of Baghdad, over the Islam empire. He brought culture to his court and tried to establish the intellectual disciplines which at that time were not flourishing in the Arabic world. He had two sons, the eldest was al-Amin while the younger was al-Mamun. Harun died in 809.

Al-Mamun became Caliph and ruled the empire from Baghdad. He continued the patronage of learning started by his father and founded an academy called the House of Wisdom where Greek philosophical and scientific works were translated.

Al-Khwarizmi's work


Al-Khwarizmi and his colleagues the Banu Musa were scholars at the House of Wisdom in Baghdad. Their tasks there involved the translation of Greek scientific manuscripts and they also studied, and wrote on, algebra, geometry and astronomy. Certainly al-Khwarizmi worked under the patronage of Al-Mamun and he dedicated two of his texts to the Caliph. These were his treatise on algebra and his treatise on astronomy. The algebra treatise Hisab al-jabr w'al-muqabala was the most famous and important of all of al-Khwarizmi's works. It is the title of this text that gives us the word "algebra". Here "al-jabr" means "completion" and is the process of removing negative terms from an equation. For example, using one of al-Khwarizmi's own examples, "al-jabr" transforms x2 = 40 x - 4 x2 into 5 x2 = 40 x. The term "al-muqabala" means "balancing" and is the process of reducing positive terms of the same power when they occur on both sides of an equation. For example, two applications of "al-muqabala" reduces 50 + 3 x + x2 = 29 + 10 x to 21 + x2 = 7 x (one application to deal with the numbers and a second to deal with the roots).

****************************************************
Source :- http://members.tripod.com/elegant_elaine/father_of_algebra.htm
****************************************************

Friday, April 9, 2010

Collections in Jav

Collections: Data structure that holds objects and provides various utility methods to
manage the data.
Collections hierarchy
Three basic flavors of collections:
„« Lists - Lists of things (classes that implement List)
„« Sets - Unique things (classes that implement Set)
„« Maps - Things with a unique ID (classes that implement Map)
The sub-flavors:
„« Ordered - You can iterate through the collection in a specific order.
„« Sorted - Collection is sorted in the natural order (alphabetical for Strings).
„« Unordered
„« Unsorted
3
. List extends Collection
In a List, every element has a index associated with it and we can add, delete, modify the
objects in a List using the index.
Let’s discuss about the 3 List implementations.
1) ArrayList
2) Vector
3) LinkedList
ľ ArrayList extends AbstractList
implements List, Cloneable, java.io.Serializable:
o Resizable-array implementation of the List interface.
o Ordered collection.
o Should be considered when there is more of data retrieval than add/delete.
o Often used methods – add(), get(), remove(), set(), size().
Implementation details:
ArrayList uses arrays internally for data management. Whenever we invoke
methods on the ArrayList object, it performs respective action on the array object to
reflect the changes.
Constructing an ArryList: There are 3 ways in which one can construct an ArrayList i.e.
ArrayList provides 3 constructors.
- Constructor that takes an integer argument – When the constructor with the
integer argument is invoked, a single dimension array (which the ArrayList uses
internally to manage the elements) is constructed with length equal to the value
given in the constructor.
- Default constructor – When the default constructor is invoked, it in turn calls the
constructor with integer arguments with the size as ‘10’.
- Constructor that takes a Collection as an argument. – Calculates the size of the
Collection passed as constructs an array of length (size*110)/100.

Thursday, April 8, 2010

Link Partner

SEO Services: SEO services India providing SEM, SEO, Web Promotion Services in India.
True Reciprocal Link Make all your link exchanges count! http://www.truereciprocallink.com
Fieca Directory



www.xpertphp.wordpress.com

http://www.webexpertindia.com/