Location: PHPKode > projects > CoreAsset > coreasset/lib/db_handle.php
<?php
class Database
{

 function get_from_database($q)
 {
  $query  = $q;
  //echo $query;echo "<br>";
  $result = mysql_query($query);
  $rw     = mysql_fetch_array($result);
  return ($rw);
 }

 function Execute($q)
 {
  $query  = $q;
  //echo "Execute :".$q."<br>";
//  $details = "UGl5dWtoIFJhbmphbiBEYXMsIFNhbmtyYWlsLCBIb3dyYWggLSA3MTEzMTM=";
  $result = mysql_query($query);
  //$count=mysql_num_rows($result);
  //echo "count=";echo $count;
  //print_r($result);
  return ($result);
 
 }

 function no_of_rows($q)
 {
  $query  = $q;
  //echo $query;
  $result = mysql_query($query);
  $no     = mysql_num_rows($result);
  return ($no);
 }

 function update($q)
 {
  $query  = $q;
 //echo "update :".$q."<br>";
  if(mysql_query($query))
  {
    return (1);
  }
 }

 function insert($q)
 {
  $query  = $q;
 //echo "Insert :".$q."<br>";
  if(mysql_query($query))
  { 
    return (mysql_insert_id());
  }
 }

 function delet($q)
 {
  $query  = $q;
  if(mysql_query($query))
  {
    return (1);
  }
 }

 function increment($tablename, $attribute, $value, $condition, $condition_on)
 {
	$query	= "UPDATE $tablename SET $attribute = $attribute + $value where $condition_on=$condition";
	if(mysql_query($query))
	{
	  return (1);
	}
 }

 function decrement ($tablename, $attribute, $value, $condition, $condition_on)
 {
	$query	= "UPDATE $tablename SET $attribute = $attribute - $value where $condition_on=$condition";
	if(mysql_query($query))
	{
	  return (1);
	}
 }
}
$database = new Database();
?>
Return current item: CoreAsset