<?php 
 
 
/**
 
You have to provide an existing connection
 
for getting a valid resource from mysql, otherwise
 
it will no work.
 
*/
 
define('db_default_host', 'localhost');
 
define('db_default_user', 'root');
 
define('db_default_password', '');
 
define('db_default_database', 'database');
 
 
@mysql_connect(db_default_host), db_default_user), db_default_password) OR die(mysql_error());
 
mysql_select_db(db_default_database) OR die(mysql_error());
 
 
$sql = "SELECT * FROM employees where employee_id=1";
 
 
$result = mysql_query($sql);
 
 
$dataObject = new QDataObject($result);
 
 
print "<pre>";
 
print_r($dataObject->getListByPosition(6));
 
print "</pre>";
 
 
print "<pre>";
 
print_r($dataObject->getListByName('LastName'));
 
print "</pre>";
 
 
/**
 
fetches the first and lastname of the third row of the object list
 
*/
 
print "<pre>";
 
print_r($dataObject->typLastName(2));
 
print_r($dataObject->getLastName(2));
 
print_r($dataObject->getFirstName(2));
 
print_r($dataObject->getLastNameOfMdEmployees(2));
 
print_r($dataObject->getFirstNameOfMdEmployees(2));
 
print "</pre>";
 
 |