Location: PHPKode > scripts > phpMyDB > phpmydb/example.php
include "phpMyDB.php";
define('DB_PASS','some pass');
$ocdb = new phpMyDB(DB_USER, DB_PASS, DB_NAME,DB_HOST);
$ocdb->insert("postshits (idPost,ip)","97,''");
echo 'test insert see id:' . $ocdb->getLastID();
$query="SELECT count(*) total FROM oc_posts";
$total_records = $ocdb->getValue($query,"APP");
echo 'Total records: '.$total_records;
$query="SELECT p.title from oc_posts p Limit 3";
$ocdb->setCache(false);//cache deactivated
$ocdb->setCache(true);//after the query is done activated once more
if ($result){//more than 1 result
	foreach ( $result as $row ){
		echo $row['title'];	
}//if count
else echo "nothing found";
echo $ocdb->getQueryCounter().' queries generated and '.$ocdb->getQueryCounter("cache").' queries cached';
Return current item: phpMyDB