<?php
//include Beans
include "Beans/countryBean.php";
include "Beans/cityBean.php";
//include HKurdQueryBuilder Class
include "../HKurdQueryBuildExec.class.php";
//Create Connection
$db=QueryBuilderExecutor::createBuilder("localhost","root","","hkurd_db");
//getBean From DataBase
$city=$db->getBean('cityBean','hkurd_city',1);
echo $city->getcity_name();
echo "-".$city->getcity_add_date();
echo "<br />";
//getBean From DataBase with Special Column Format
$city=$db->getBeanWithSpecificationItems('cityBean','hkurd_city',1,'DATE_FORMAT(city_add_date,"%W %M %Y") AS city_add_date');
echo $city->getcity_add_date();
//getVector Of Beans From DataBase with Condation
$citiesVector=$db->getVectorBeans('cityBean','hkurd_city','WHERE city_id>1');
for($i=0;$i<$citiesVector->size();$i++){
$city=$citiesVector->get($i);
echo $city->getcity_name();
echo "-".$city->getcity_add_date();
echo "<br />";
}
//getVector Of Beans From DataBase with Custom Query
$customVector=$db->getBeansCustomQuery('cityBean','SELECT ci.city_name AS city_name ,ci.city_add_date AS city_add_date FROM hkurd_city ci,hkurd_country co where ci.city_country_id=co.country_id AND co.country_desc=\'free\'','ci.');
for($i=0;$i<$customVector->size();$i++){
$city=$customVector->get($i);
echo $city->getcity_name();
echo "-".$city->getcity_add_date();
echo "<br />";
}
?>
|