<?


class instaAyar{
    public $cekilcekUser,$loginUser,$loginPassword ,$veri_limit,$count ;


 
 

    function __construct(){
        $this->dbinit();
    }
    
    private function dbinit(){
        global $dbh;
        $db=$dbh;
    
        $stmt = $dbh->query("SELECT * FROM instaAyar ");
        $ayar = $stmt->fetch(PDO::FETCH_ASSOC);
        $this->cekilcekUser=$ayar["cekilcekUser"];
        $this->loginUser=$ayar["loginUser"];
        $this->loginPassword=$ayar["loginPassword"];
        $this->veri_limit=$ayar["veri_limit"];

        $cc = $dbh->prepare('select * from urunler_insta');
        $cc->execute();
        $count = $cc->rowCount();
        $this->count=$count;

       
    }  
}
 



function fotogir($id,$resim,$aciklama,$link){
    global $dbh;
    $db=$dbh;
    $query = $db->prepare("INSERT INTO urunler_insta SET  id = ?, resim = ?,  aciklama = ?,  link = ?"  ); 
    $insert = $query->execute(array(         $id,$resim, $aciklama,$link    ));

    if ( $insert ){
        $last_id = $db->lastInsertId();
    }else{ 
    }
}


function eneskiyisil($limit){
    global $db;
    $db=$dbh;
    $query = $db->prepare("delete from urunler_insta order by zaman asc limit $limit"  ); 
    $insert = $query->execute(array(
         $id,$resim, $aciklama,$link
    ));
    if ( $insert ){
        $last_id = $db->lastInsertId();
    }else{
    }
}

?>