<?php 
/****************************************************************/
/*          e-mo.pl © 2017                                      */
/*          http://www.e-mo.com.pl                              */
/*          e-mail: info@e-mo.pl                                */
/*          produkt: Action2osCommerce                          */
/*          wersja: 1.9.7                                       */
/*          webserwis: oscGold                                  */
/*          sciezka: https://www.e-mo.com.pl/plikit,1918,533545b244d7d.php*/
/*          data: 2017-09-25                                    */
/*          godz: 10:45:27                                      */
/****************************************************************/

class manufacturers_info { 
	public $Conn = 0;
	public $errMsg = '';
	public $errNo= 0;
	public $manufacturers_id=0;
	public $languages_id=0;
	public $manufacturers_url='';
	public $url_clicked=0;
	public $date_last_click=0;

	public function Dodaj(){
		$zwrot=true;
		$query="Insert manufacturers_info (manufacturers_id, languages_id, manufacturers_url, url_clicked, date_last_click) VALUES (:manufacturers_id, :languages_id, :manufacturers_url, :url_clicked, :date_last_click) ";
		$sth = $this->Conn->prepare($query);

		$sth->bindParam(':manufacturers_id', $this->manufacturers_id, PDO::PARAM_INT);
		$sth->bindParam(':languages_id', $this->languages_id, PDO::PARAM_INT);
		$sth->bindParam(':manufacturers_url', $this->manufacturers_url, PDO::PARAM_STR);
		$sth->bindParam(':url_clicked', $this->url_clicked, PDO::PARAM_INT);
		$sth->bindParam(':date_last_click', $this->date_last_click, PDO::PARAM_STR);

		$sth->execute();

		if($sth->errorCode() != 0){
			$zwrot=false;
			$this->errMsg = $sth->errorInfo();
			$this->errNo = $sth->errorCode();
		}

		 return $zwrot;
	 } 
	public function Zmien(){
		$zwrot=true;
		$query="Update manufacturers_info SET manufacturers_id=:manufacturers_id, languages_id=:languages_id, manufacturers_url=:manufacturers_url, url_clicked=:url_clicked, date_last_click=:date_last_click";
		$sth = $this->Conn->prepare($query);

		$sth->bindParam(':manufacturers_id', $this->manufacturers_id, PDO::PARAM_INT);
		$sth->bindParam(':languages_id', $this->languages_id, PDO::PARAM_INT);
		$sth->bindParam(':manufacturers_url', $this->manufacturers_url, PDO::PARAM_STR);
		$sth->bindParam(':url_clicked', $this->url_clicked, PDO::PARAM_INT);
		$sth->bindParam(':date_last_click', $this->date_last_click, PDO::PARAM_STR);

		$sth->execute();

		if($sth->errorCode() != 0){
			$zwrot=false;
			$this->errMsg = $sth->errorInfo();
			$this->errNo = $sth->errorCode();
		}

		 return $zwrot;
	 } 
	public function Usun(){
		$zwrot=true;
		$query="Delete from manufacturers_info";

		$sth = $this->Conn->prepare($query);

		$sth->execute();

		if($sth->errorCode() != 0){
			$zwrot=false;
			$this->errMsg = $sth->errorInfo();
			$this->errNo = $sth->errorCode();
		}

		 return $zwrot;
	 } 
	public function Lista(){
		$query='Select * from manufacturers_info';
		$sth = $this->Conn->prepare($query);
		$sth->execute();
		$tablica = array();
		$x=0;

		while ($row = $sth->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT))
		{
			foreach ($row as $k => $v)
			{
				$tablica[$x][$k]=trim($v);
			}
			$x++;
		}

		return $tablica;
	}
}
?>
