<?php
require("connectivity.php");
$object = new wrapperClass();
/* Select Query */
$data_table = 'country';
$data_fields = array('id','Name','Population'); // or array('*');
$data_where_condition = array('id<'=>'1000','Population>'=>'0','Population<'=>'1000');
$order_by = "id";
$return_data_select = $object->getData($data_table,$data_fields,$data_where_condition,$order_by);
echo "<pre>";
print_r($return_data_select);
echo "</pre>";
/* Insert Query */
$data_fields = array('id'=>'1002','code'=>'ABC');
$return_data_insert = $object->insertRecord($data_table,$data_fields);
echo "<pre>";
print_r($return_data_insert);
echo "</pre>";
/* Delete Record */
$data_fields = array('Population>'=>'0','Population<'=>'100');
$return_data_delete = $object->deleteRecord($data_table,$data_fields);
echo "<pre>";
print_r($return_data_delete);
echo "</pre>";
/* update Record */
$data_fields_update = array('Code'=>'XYZ');
$data_fields_where = array('id<'=>'1000');
$return_data_update = $object->updateRecord($data_table,$data_fields_update,$data_fields_where);
echo "<pre>";
print_r($return_data_update);
echo "</pre>";
/*Simple Select Query*/
$query = "select * from $data_table where id<'100'";
$returnData = $object->simpleGetData($query);
echo "<pre>";
print_r($returnData);
echo "</pre>";
/* Query for displaying the data into tabular format using Databsase */
/* Also giving the direct query */
$query = "select id,name from $data_table where id='10000'";
$return_data = $object->executeQuery($query);
if(count($return_data)>0)
{
echo "<table border='1'><tr>";
foreach($return_data[0] as $key=>$value)
{
echo "<td>$key</td>";
}
for($i=0;$i<count($return_data);$i++)
{
echo "</tr><tr>";
foreach($return_data[$i] as $value)
{
if($value!='')
{
echo "<td>$value</td>";
}
else
{
echo "<td> </td>";
}
}
echo "</tr>";
}
echo "</table>";
}
else
{
echo "Empty";
}
?>
|