View file base/Orders.php

File size: 1.47Kb
<? //by rine(Andrey Arapov) & BEPDuKT(Aleksey Ivanov) site: dizkod.ru


  	/**
	 * CLASS ORDERS
	 * Author given violin RAINE
	 * Participant of the group DECO
	 * E-mail: [email protected] OR [email protected]
	 * ICQ:9927785
	 */








class Orders extends Base{

    function __construct()
    {

    }



	public static function order($set='assoc',$param,$imp)
   {

   	if((empty($set)) || (empty($param)) || (empty($imp)))
   	{
   		echo 'Ошибка!!!Выбор данных из бд по '.$param.' не выполнен!';
   	}
     if($set=='assoc')
    {
    	return mysql_fetch_assoc(mysql_query("SELECT * FROM `order` WHERE `$param`='$imp'"));
    }
    if($set=='num')
    {
    	return mysql_num_rows(mysql_query("SELECT * FROM `order` WHERE `$param`='$imp'"));
    }


     }
    public function insert($name,$order,$opis,$cat,$sum)
    {

    $data=date("d.m.Y");
    $time=date("H:i:s");
    $tm=time()+86400;
    $result=mysql_query("INSERT INTO `order` VALUES ('0','$name','$order','$opis','$data','$time','0','$cat',$tm,$sum,'0.00')");
    if (!$result){
			die(mysql_error());}
	return mysql_insert_id();
    }

	public function insert_mess($id,$name,$mess,$log)
    {

    $data=date("d.m.Y");
    $time=date("H:i:s");
    $tm=time()+86400;
    $result=mysql_query("INSERT INTO `order_mess` VALUES ('0','$id','$name','$mess','$data','$time','0','$tm','$log')");
    if (!$result){
			die(mysql_error());}
	return mysql_insert_id();
    }


}
?>