What is better many functions each one with your query calling record by record or a single query with a single array?

0

Hello everyone for the first time I come here not because my code does not work haha but because I think that when I have many records my database will be encouraged, I explain I am generating a pdf document and have values that I take from the database for not complicating my life I have taken a code that I found out there:

class Tabla {
        public function folio() {
                try {
                $orden_de_compra = $_GET['orden_de_compra'];
                include("resource/Database.php");

                $q= $db->query("SELECT folio FROM salida_materiales WHERE orden_de_compra=$orden_de_compra");
    $folio = $q->fetchColumn();




            } catch (PDOException $e) {
                //echo "Exeption: " .$e->getMessage();
                $result = false;
            }
            $query = null;
            $db = null;
            return $folio;        
        }

}

These values do not go in a table but on the page they are separated so I have to call it between text lines and I do the following for each one that is already a lot I thought to start using an array. bad practice? I do not want that my project put in place of problems in the long run certainly the query to mariadb does not close? I've never done it.

$tabla = new Tabla();


  $cliente = $tabla->cliente();

$html2 = utf8_decode('<br>Destino: <b>'. ($cliente) . '</b>');
    
asked by Daniel Treviño 12.09.2017 в 20:42
source

0 answers