Location: PHPKode > scripts > phpMysqlSessions > phpmysqlsessions/index.php
	// Need the class definition
	require "_class.session.php";

	// Instantiate a session
	$my_session=new session_class("znet_shop");

	// Remove old session from db (300 sec.)

	// Start session or get previous data

	/*	For this example, I will use normal variables as
		well as an array of values to show how to use arrays
		of data for the sessions (may be used in something like
		a shopping cart application.

	// First, we will assign the variables some values
	$var3=$var1 ." != " .$var2;	// "var1 != 2"

	// Now let's make an array
		$array1[$i]="element ".$i;

	// Let's make another
	$array2=array("first"=>1, "second"=>2, "third"=>3, "fourth"=>4);

	// Now we will register the variables into the session data if they aren't
	// already registered

	// Now of the arrays

	// Now that all the data is registered as session data, let's save it.
<h1>Session Test</h1>
The following values should be saved in your session database:<br>
Session ID: <? echo $my_sid ?><br>
<table border=3>
 <tr><td>$var1</td><td><? echo $var1 ?></td></tr>
 <tr><td>$var2</td><td><? echo $var2 ?></td></tr>
 <tr><td>$var3</td><td><? echo $var3 ?></td></tr>
 <tr><td>$arr1</td><td><? echo $arr1 ?></td></tr>
 <tr><td>$arr2</td><td><? echo $arr2 ?></td></tr>

<a href="next.php">Next</a>
Return current item: phpMysqlSessions