Location: PHPKode > scripts > xMySQL > xmysql/testdata.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<title>Unbenannt</title>
</head>

<body>

<?php
if ( file_exists ( "objectstatus.class.php" ) )
	include ( "objectstatus.class.php" );
include ( "xmysql.class.php" );

if ( class_exists ( "objectStatus" ) )
	$os = new objectStatus ();
else
	$os = "";

$db = new xMySQL ( "xmysql.host_list.php", 0, &$os );

// Step 1: Create the table
$query = "create table if not exists xmysql_test ( test_id int (10) unsigned default '1' not null auto_increment, test_field_1 varchar (255) not null, test_field_2 varchar (255) not null, test_field_3 int (10) unsigned default 0 not null, test_field_4 decimal (6,2) unsigned default 0.00 not null, primary key test_id(test_id)) type=MYISAM;";

$x = $db->xQuery ( $query );



// Step 2: Insert some data
if ( $x )
{
	$y = 0;
	for ( $i=1; $i<10; $i++ )
	{
		$query = "insert into xmysql_test (test_field_1, test_field_2, test_field_3, test_field_4) values (\"Test $i\", \"Blub\", $i, " . ($i/2) . ");";
		$y = $db->xQuery ( $query );
	}
}

if ( $x && $y )
{
	echo "<b>Queries executed...</b>";
	if ( class_exists ( "objectStatus" ) )
		echo $db->os->statusPrintout ();
}
else
{
	if ( class_exists ( "objectStatus" ) )
		echo $db->os->statusPrintout ();
	else
		echo "<b>Failed executing queries...</b>";
}
?>

</body>
</html>
Return current item: xMySQL