<?php
include_once 'Parameterable.class.php';
include_once 'SQLable.class.php';
include_once 'DBconnect.class.php';
include_once 'DBQuery.class.php';
include_once 'RunDBQuery.class.php';
include_once 'MyOneLineSQL.class.php';
DBconnect::doDBConnection ();
$resultArray = array ( );
$resultObject = MyOneLineSQL::doSelect ( 'accounts', DBC, array ('acc_uname' ) );
$resultArray = $resultObject->getQueryResultArray ();
$intResultArray = $resultObject->getIntIndexedResultArray ();
echo 'Assoc Array dump';
echo '<br />';
var_dump ( $resultArray );
echo '<br />';
echo '<br />';
echo 'Int indexed array dump';
echo '<br />';
var_dump ( $intResultArray );
echo '<br />';
echo '<br />';
echo 'String representation of result array with field value pair';
echo '<br />';
echo $resultObject->toString ();
echo '<br />';
echo '<br />';
echo 'String representation of result array with just values';
echo '<br />';
echo $resultObject->toStringV ();
echo '<br />';
echo '<br />';
echo 'Number of rows';
echo '<br />';
echo $resultObject->getNumberOfRows ();
echo '<br />';
echo '<br />';
echo 'Number of fields';
echo '<br />';
echo $resultObject->getNumberOfFields ();
echo '<br />';
echo '<br />';
echo 'Value of acc_uname for row 0';
echo '<br />';
echo $resultObject->giveValueOf ( 'acc_uname', 0 );
echo '<br />';
echo '<br />';
echo 'Value of acc_uname for row 1';
echo '<br />';
echo $resultObject->giveValueOf ( 'acc_uname', 1 );
echo '<br />';
echo '<br />';
echo 'Query info';
echo '<br />';
echo $resultObject->getQueryResultInfo ();
echo '<br />';
echo '<br />';
echo 'Query executed';
echo '<br />';
echo $resultObject->getQueryToRun ();
echo '<br />';
echo '<br />';
echo 'Keyword used by DBQuery object';
echo '<br />';
echo $resultObject->getKeyword ();
echo '<br />';
echo '<br />';
$resultObject2 = MyOneLineSQL::doUpdateWhere ( 'accounts', DBC, "username='docooph'", array ("acc_email='me@me.com'" ) );
echo 'Affected Rows from query ' . $resultObject2->getQueryToRun ();
echo '<br />';
echo $resultObject2->getAffectedRows () . " This is correct as there is no username field in database";
echo '<br />';
echo '<br />';
$resultObject3 = MyOneLineSQL::doUpdateWhere ( 'accounts', DBC, "acc_uname='docooph'", array ("acc_email='me@me.com'" ) );
echo 'Affected Rows from query ' . $resultObject3->getQueryToRun ();
echo '<br />';
echo $resultObject3->getAffectedRows ();
echo '<br />';
echo '<br />';
$resultObject4 = MyOneLineSQL::doUpdateWhere ( 'accounts', DBC, "acc_uname='docooph2'", array ("acc_email='me2@me.com'" ) );
echo 'Affected Rows from query ' . $resultObject4->getQueryToRun ();
echo '<br />';
echo $resultObject4->getAffectedRows ();
echo '<br />';
echo '<br />';
$resultArray = array ( );
$resultObject = MyOneLineSQL::doSelect ( 'accounts', DBC, array ('acc_uname, acc_email' ) );
$resultArray = $resultObject->getQueryResultArray ();
$intResultArray = $resultObject->getIntIndexedResultArray ();
echo 'Assoc Array dump';
echo '<br />';
var_dump ( $resultArray );
echo '<br />';
echo '<br />';
echo 'Int indexed array dump';
echo '<br />';
var_dump ( $intResultArray );
echo '<br />';
echo '<br />';
echo 'String representation of result array with field value pair';
echo '<br />';
echo $resultObject->toString ();
echo '<br />';
echo '<br />';
echo 'String representation of result array with just values';
echo '<br />';
echo $resultObject->toStringV ();
echo '<br />';
echo '<br />';
echo 'Number of rows';
echo '<br />';
echo $resultObject->getNumberOfRows ();
echo '<br />';
echo '<br />';
echo 'Number of fields';
echo '<br />';
echo $resultObject->getNumberOfFields ();
echo '<br />';
echo '<br />';
echo 'Value of acc_uname for row 0';
echo '<br />';
echo $resultObject->giveValueOf ( 'acc_uname', 0 );
echo '<br />';
echo '<br />';
echo 'Value of acc_uname for row 1';
echo '<br />';
echo $resultObject->giveValueOf ( 'acc_uname', 1 );
echo '<br />';
echo '<br />';
echo 'Query info';
echo '<br />';
echo $resultObject->getQueryResultInfo ();
echo '<br />';
echo '<br />';
echo 'Query executed';
echo '<br />';
echo $resultObject->getQueryToRun ();
echo '<br />';
echo '<br />';
echo 'Keyword used by DBQuery object';
echo '<br />';
echo $resultObject->getKeyword ();
echo '<br />';
echo '<br />';
$usernameCheck = MyOneLineSQL::doSelectWhere ( 'accounts', DBC, "acc_uname='dummy'", array ('acc_uname' ) );
if ($usernameCheck->getNumberOfRows () == 0)
{
$resultObject = MyOneLineSQL::doInsert ( 'accounts(acc_uname, acc_pass, acc_email)', DBC, array ('dummy', 'xxxxxxxx', 'dummy@site.com' ) );
if (strip_tags ( $resultObject->toStringV () ) == 'success')
{
echo "New values inserted in database";
echo '<br />'; echo '<br />';
}
}
else
{
echo "dummy user already in database";
echo '<br />'; echo '<br />';
}
$resultArray = array ( );
$resultObject = MyOneLineSQL::doSelect ( 'accounts', DBC, array ('acc_uname, acc_email' ) );
$resultArray = $resultObject->getQueryResultArray ();
$intResultArray = $resultObject->getIntIndexedResultArray ();
echo 'Assoc Array dump';
echo '<br />';
var_dump ( $resultArray );
echo '<br />';
echo '<br />';
echo 'Int indexed array dump';
echo '<br />';
var_dump ( $intResultArray );
echo '<br />';
echo '<br />';
echo 'String representation of result array with field value pair';
echo '<br />';
echo $resultObject->toString ();
echo '<br />';
echo '<br />';
echo 'String representation of result array with just values';
echo '<br />';
echo $resultObject->toStringV ();
echo '<br />';
echo '<br />';
echo 'Number of rows';
echo '<br />';
echo $resultObject->getNumberOfRows ();
echo '<br />';
echo '<br />';
echo 'Number of fields';
echo '<br />';
echo $resultObject->getNumberOfFields ();
echo '<br />';
echo '<br />';
echo 'Value of acc_uname for row 0';
echo '<br />';
echo $resultObject->giveValueOf ( 'acc_uname', 0 );
echo '<br />';
echo '<br />';
echo 'Value of acc_uname for row 2';
echo '<br />';
echo $resultObject->giveValueOf ( 'acc_uname', 2 );
echo '<br />';
echo '<br />';
echo 'Query info';
echo '<br />';
echo $resultObject->getQueryResultInfo ();
echo '<br />';
echo '<br />';
echo 'Query executed';
echo '<br />';
echo $resultObject->getQueryToRun ();
echo '<br />';
echo '<br />';
echo 'Keyword used by DBQuery object';
echo '<br />';
echo $resultObject->getKeyword ();
echo '<br />';
echo '<br />';
?>
|