<?php

include 'database.php';

class Proveedores extends DataBase{
    
    public function __construct() {
        parent::__construct();
    }
    
    public function buscar($proveedor){
$_SESSION['datos'] = array();
        $sth = $this->prepare('SELECT * FROM proveedores '
                . 'WHERE razon LIKE "%'.$proveedor.'%" ORDER BY razon');
        $sth->execute();
        $result = $sth->fetchAll();
        
        foreach ($result as $key => $value) {
            $_SESSION['datos'][] = array("value" => $value['razon'],
                "nitProveedor" => $value['nit']);
        }
        
        return $_SESSION['datos'];
        
    }
    
}

