diff --git a/dev/initdata/generate-produit.php b/dev/initdata/generate-produit.php index 776e528020c..37c7557b327 100644 --- a/dev/initdata/generate-produit.php +++ b/dev/initdata/generate-produit.php @@ -60,17 +60,25 @@ $user->getrights(); $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array(); -if ($db->query($sql)) { - $num = $db->num_rows(); $i = 0; - while ($i < $num) { $row = $db->fetch_row($i); $productsid[$i] = $row[0]; $i++; } } +$resql=$db->query($sql); +if ($resql) { + $num = $db->num_rows($resql); $i = 0; + while ($i < $num) { $row = $db->fetch_row($resql); $productsid[$i] = $row[0]; $i++; } +} $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array(); -if ($db->query($sql)) { $num = $db->num_rows(); $i = 0; -while ($i < $num) { $row = $db->fetch_row($i); $societesid[$i] = $row[0]; $i++; } } else { print "err"; } +$resql=$db->query($sql); +if ($resql) { + $num = $db->num_rows($resql); $i = 0; + while ($i < $num) { $row = $db->fetch_row($resql); $societesid[$i] = $row[0]; $i++; } +} else { print "err"; } $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $commandesid = array(); -if ($db->query($sql)) { $num = $db->num_rows(); $i = 0; -while ($i < $num) { $row = $db->fetch_row($i); $commandesid[$i] = $row[0]; $i++; } } else { print "err"; } +$resql=$db->query($sql); +if ($resql) { + $num = $db->num_rows($resql); $i = 0; + while ($i < $num) { $row = $db->fetch_row($resql); $commandesid[$i] = $row[0]; $i++; } +} else { print "err"; } print "Generates ".GEN_NUMBER_PRODUIT." products\n"; diff --git a/dev/initdata/generate-societe.php b/dev/initdata/generate-societe.php index bd78878fd80..58fe6269eff 100644 --- a/dev/initdata/generate-societe.php +++ b/dev/initdata/generate-societe.php @@ -63,17 +63,25 @@ $user->getrights(); $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array(); -if ($db->query($sql)) { - $num = $db->num_rows(); $i = 0; - while ($i < $num) { $row = $db->fetch_row($i); $productsid[$i] = $row[0]; $i++; } } +$resql=$db->query($sql); +if ($resql) { + $num = $db->num_rows($resql); $i = 0; + while ($i < $num) { $row = $db->fetch_row($resql); $productsid[$i] = $row[0]; $i++; } +} $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array(); -if ($db->query($sql)) { $num = $db->num_rows(); $i = 0; -while ($i < $num) { $row = $db->fetch_row($i); $societesid[$i] = $row[0]; $i++; } } else { print "err"; } +$resql=$db->query($sql); +if ($resql) { + $num = $db->num_rows($resql); $i = 0; + while ($i < $num) { $row = $db->fetch_row($resql); $societesid[$i] = $row[0]; $i++; } +} else { print "err"; } $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $commandesid = array(); -if ($db->query($sql)) { $num = $db->num_rows(); $i = 0; -while ($i < $num) { $row = $db->fetch_row($i); $commandesid[$i] = $row[0]; $i++; } } else { print "err"; } +$resql=$db->query($sql); +if ($resql) { + $num = $db->num_rows($resql); $i = 0; + while ($i < $num) { $row = $db->fetch_row($resql); $commandesid[$i] = $row[0]; $i++; } +} else { print "err"; } diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 11dd53f374d..364c714aaa1 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1534,16 +1534,16 @@ class Adherent extends CommonObject if ($result) { - if ($mydb->num_rows()) + if ($mydb->num_rows($result)) { # nous avons au moins une reponse - $mydb->close(); + $mydb->close($result); return 1; } else { # nous n'avons pas de reponse => n'existe pas - $mydb->close(); + $mydb->close($result); return 0; } } diff --git a/htdocs/admin/system/dbtable.php b/htdocs/admin/system/dbtable.php index 881d5fcd8e1..086b41639ab 100644 --- a/htdocs/admin/system/dbtable.php +++ b/htdocs/admin/system/dbtable.php @@ -108,12 +108,12 @@ else $result = $db->query($sql); if ($result) { - $num = $db->num_rows(); + $num = $db->num_rows($result); $var=True; $i=0; while ($i < $num) { - $row = $db->fetch_row($i); + $row = $db->fetch_row($result); $var=!$var; print ""; diff --git a/htdocs/boutique/commande/class/boutiquecommande.class.php b/htdocs/boutique/commande/class/boutiquecommande.class.php index 561607e8daf..33a5e83bc35 100644 --- a/htdocs/boutique/commande/class/boutiquecommande.class.php +++ b/htdocs/boutique/commande/class/boutiquecommande.class.php @@ -98,30 +98,29 @@ class BoutiqueCommande $sql = "SELECT value, class "; $sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total WHERE orders_id = $id"; - $result = $this->db->query($sql) ; - + $result = $this->db->query($sql); if ( $result ) - { - $num = $this->db->num_rows(); + { + $num = $this->db->num_rows($result); - while ($i < $num) - { - $array = $this->db->fetch_array($i); - if ($array["class"] == 'ot_total') - { - $this->total_ot_total = $array["value"]; - } - if ($array["class"] == 'ot_shipping') - { - $this->total_ot_shipping = $array["value"]; - } - $i++; - } - } - else - { - print $this->db->error(); - } + while ($i < $num) + { + $array = $this->db->fetch_array($result); + if ($array["class"] == 'ot_total') + { + $this->total_ot_total = $array["value"]; + } + if ($array["class"] == 'ot_shipping') + { + $this->total_ot_shipping = $array["value"]; + } + $i++; + } + } + else + { + print $this->db->error(); + } } else diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index 28b9bba30cf..0c1f82495bb 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -104,7 +104,7 @@ $sql.= " ORDER BY label"; $result = $db->query($sql); if ($result) { - $num = $db->num_rows(); + $num = $db->num_rows($result); $i = 0; $total = 0; $var=True; @@ -119,7 +119,7 @@ if ($result) print ""; $i++; } - $db->free(); + $db->free($result); } /* diff --git a/htdocs/compta/dons/index.php b/htdocs/compta/dons/index.php index 4b022211796..33cfb840311 100644 --- a/htdocs/compta/dons/index.php +++ b/htdocs/compta/dons/index.php @@ -47,7 +47,7 @@ $result = $db->query($sql); if ($result) { - $num = $db->num_rows(); + $num = $db->num_rows($result); $i = 0; while ($i < $num) { diff --git a/htdocs/compta/prelevement/class/bon-prelevement.class.php b/htdocs/compta/prelevement/class/bon-prelevement.class.php index e7dd686d438..99153aebc3d 100644 --- a/htdocs/compta/prelevement/class/bon-prelevement.class.php +++ b/htdocs/compta/prelevement/class/bon-prelevement.class.php @@ -147,9 +147,10 @@ class BonPrelevement extends CommonObject $sql.= " AND code_guichet ='".$code_guichet."'"; $sql.= " AND number ='".$number."'"; - if ($this->db->query($sql)) + $resql=$this->db->query($sql); + if ($resql) { - $num = $this->db->num_rows(); + $num = $this->db->num_rows($resql); } else { diff --git a/htdocs/compta/stats/comp.php b/htdocs/compta/stats/comp.php index 2ba12be65c3..2af1fe37067 100644 --- a/htdocs/compta/stats/comp.php +++ b/htdocs/compta/stats/comp.php @@ -55,7 +55,7 @@ function propals ($db, $year, $month) $sql .= " ORDER BY p.fk_statut"; $result = $db->query($sql); - $num = $db->num_rows(); + $num = $db->num_rows($result); $i = 0; print ""; print ""; @@ -131,7 +131,7 @@ function factures ($db, $year, $month, $paye) $result = $db->query($sql); if ($result) { - $num = $db->num_rows(); + $num = $db->num_rows($result); if ($num > 0) { $i = 0; @@ -192,7 +192,7 @@ function pt ($db, $sql, $year) $result = $db->query($sql); if ($result) { - $num = $db->num_rows(); + $num = $db->num_rows($result); $i = 0; $total = 0 ; print '
Propal
'; print ""; diff --git a/htdocs/compta/stats/prev.php b/htdocs/compta/stats/prev.php index 155b9c9257f..482d76261fe 100644 --- a/htdocs/compta/stats/prev.php +++ b/htdocs/compta/stats/prev.php @@ -42,7 +42,7 @@ function pt ($db, $sql, $title) { $result = $db->query($sql); if ($result) { - $num = $db->num_rows(); + $num = $db->num_rows($result); $i = 0; $total = 0 ; $var=True; diff --git a/htdocs/compta/tva.php b/htdocs/compta/tva.php index 8a5d39c1781..4e344e09b28 100644 --- a/htdocs/compta/tva.php +++ b/htdocs/compta/tva.php @@ -34,7 +34,7 @@ function pt ($db, $sql, $date) { $result = $db->query($sql); if ($result) { - $num = $db->num_rows(); + $num = $db->num_rows($result); $i = 0; $total = 0 ; print "
"; print ""; diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index ede5a592bf9..5763732673f 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -360,7 +360,7 @@ class Tva extends CommonObject if ($result) { - if ($this->db->num_rows()) + if ($this->db->num_rows($result)) { $obj = $this->db->fetch_object($result); return $obj->amount; @@ -370,7 +370,7 @@ class Tva extends CommonObject return 0; } - $this->db->free(); + $this->db->free($result); } else @@ -399,7 +399,7 @@ class Tva extends CommonObject if ($result) { - if ($this->db->num_rows()) + if ($this->db->num_rows($result)) { $obj = $this->db->fetch_object($result); return $obj->total_tva; @@ -441,7 +441,7 @@ class Tva extends CommonObject if ($result) { - if ($this->db->num_rows()) + if ($this->db->num_rows($result)) { $obj = $this->db->fetch_object($result); return $obj->amount; diff --git a/htdocs/domain/index.php b/htdocs/domain/index.php index 1a9c898633f..0fb95dc9992 100644 --- a/htdocs/domain/index.php +++ b/htdocs/domain/index.php @@ -51,7 +51,7 @@ if ($result) $var=True; - $num = $db->num_rows(); + $num = $db->num_rows($result); $i = 0; $total = 0; $sep = 0; diff --git a/htdocs/expedition/class/expeditionstats.class.php b/htdocs/expedition/class/expeditionstats.class.php index 03158feba51..13e7de1b589 100644 --- a/htdocs/expedition/class/expeditionstats.class.php +++ b/htdocs/expedition/class/expeditionstats.class.php @@ -51,18 +51,19 @@ class ExpeditionStats $sql.= " AND entity = ".$conf->entity; $sql.= " GROUP BY dm DESC"; - if ($this->db->query($sql)) + $resql=$this->db->query($sql); + if ($resql) { - $num = $this->db->num_rows(); + $num = $this->db->num_rows($resql); $i = 0; while ($i < $num) { - $row = $this->db->fetch_row($i); + $row = $this->db->fetch_row($resql); $result[$i] = $row; $i++; } - $this->db->free(); + $this->db->free($resql); } return $result; } @@ -82,18 +83,19 @@ class ExpeditionStats $sql.= " AND entity = ".$conf->entity; $sql.= " GROUP BY dm DESC"; - if ($this->db->query($sql)) + $resql=$this->db->query($sql); + if ($resql) { - $num = $this->db->num_rows(); + $num = $this->db->num_rows($resql); $i = 0; while ($i < $num) { - $row = $this->db->fetch_row($i); + $row = $this->db->fetch_row($resql); $j = $row[0] * 1; $result[$j] = $row[1]; $i++; } - $this->db->free(); + $this->db->free($resql); } for ($i = 1 ; $i < 13 ; $i++) { diff --git a/htdocs/expedition/stats/index.php b/htdocs/expedition/stats/index.php index 165971b168f..314ec314762 100644 --- a/htdocs/expedition/stats/index.php +++ b/htdocs/expedition/stats/index.php @@ -34,7 +34,7 @@ $langs->load("sendings"); llxHeader(); print_fiche_titre($langs->trans("StatisticsOfSendings"), $mesg); - + print '
'; print ''; print ''; @@ -45,13 +45,14 @@ $sql.= " WHERE fk_statut > 0"; $sql.= " AND entity = ".$conf->entity; $sql.= " GROUP BY dm DESC "; -if ($db->query($sql)) +$resql=$db->query($sql); +if ($resql) { - $num = $db->num_rows(); + $num = $db->num_rows($resql); $i = 0; while ($i < $num) { - $row = $db->fetch_row($i); + $row = $db->fetch_row($resql); $nbproduct = $row[0]; $year = $row[1]; print ""; diff --git a/htdocs/fichinter/rapport.php b/htdocs/fichinter/rapport.php index 8a8abb2d18e..e441657c6b9 100644 --- a/htdocs/fichinter/rapport.php +++ b/htdocs/fichinter/rapport.php @@ -94,7 +94,7 @@ $sql .= " ORDER BY $sortfield $sortorder "; $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows(); + $num = $db->num_rows($resql); $title = $langs->trans("Report")." ".dol_print_date(strtotime($start),"%B %Y"); print_barre_liste($title, $page, "rapport.php","&socid=".$socid,$sortfield,$sortorder,'',$num); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 1b04e9679f2..8c7f987156d 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1083,7 +1083,7 @@ class CommandeFournisseur extends Commande if ($resql) { $i = 0; - $num = $this->db->num_rows(); + $num = $this->db->num_rows($resql); $this->methodes_commande = array(); while ($i < $num) { diff --git a/htdocs/fourn/product/index.php b/htdocs/fourn/product/index.php index 39a6d882ea0..a66155d4051 100644 --- a/htdocs/fourn/product/index.php +++ b/htdocs/fourn/product/index.php @@ -61,17 +61,18 @@ print "
'.$langs->trans("Year").''.$langs->trans("NbOfSendings").'

\n"; */ $prodser = array(); $sql = "SELECT count(*), fk_product_type FROM ".MAIN_DB_PREFIX."product as p GROUP BY fk_product_type"; -if ($db->query($sql)) +$resql=$db->query($sql); +if ($resql) { - $num = $db->num_rows(); + $num = $db->num_rows($resql); $i = 0; while ($i < $num) { - $row = $db->fetch_row($i); + $row = $db->fetch_row($resql); $prodser[$row[1]] = $row[0]; $i++; } - $db->free(); + $db->free($resql); } print ''; diff --git a/htdocs/includes/modules/societe/mod_codecompta_digitaria.php b/htdocs/includes/modules/societe/mod_codecompta_digitaria.php index b4ff0b41e7e..bcd122b2268 100644 --- a/htdocs/includes/modules/societe/mod_codecompta_digitaria.php +++ b/htdocs/includes/modules/societe/mod_codecompta_digitaria.php @@ -19,94 +19,95 @@ */ /** - \file htdocs/includes/modules/societe/mod_codecompta_digitaria.php - \ingroup societe - \brief Fichier de la classe des gestion digitaria des codes compta des societes clientes - \version $Id$ -*/ + \file htdocs/includes/modules/societe/mod_codecompta_digitaria.php + \ingroup societe + \brief Fichier de la classe des gestion digitaria des codes compta des societes clientes + \version $Id$ + */ require_once(DOL_DOCUMENT_ROOT."/includes/modules/societe/modules_societe.class.php"); /** - \class mod_codecompta_digitaria - \brief Classe permettant la gestion digitaria des codes compta des societes clients -*/ + \class mod_codecompta_digitaria + \brief Classe permettant la gestion digitaria des codes compta des societes clients + */ class mod_codecompta_digitaria extends ModeleAccountancyCode { var $nom; - function mod_codecompta_digitaria() - { - $this->nom = "Digitaria"; - } + function mod_codecompta_digitaria() + { + $this->nom = "Digitaria"; + } function info($langs) { return $langs->trans("ModuleCompanyCode".$this->nom); } - /** - * \brief Renvoi code - * \param DB Handler d'acc�s base - * \param societe Objet societe - */ - function get_code($DB, $societe) - { - $i = 0; - $this->db = $DB; + /** + * \brief Renvoi code + * \param DB Handler d'acc�s base + * \param societe Objet societe + */ + function get_code($DB, $societe) + { + $i = 0; + $this->db = $DB; - $this->code = "C".substr($societe->code_client,0,5); + $this->code = "C".substr($societe->code_client,0,5); - $is_dispo = $this->verif($DB, $this->code); + $is_dispo = $this->verif($DB, $this->code); - while ( $is_dispo <> 0 && $i < 37) - { - $arr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + while ( $is_dispo <> 0 && $i < 37) + { + $arr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - $this->code = substr($this->code,0,5) . substr($arr, $i, 1); + $this->code = substr($this->code,0,5) . substr($arr, $i, 1); - $is_dispo = $this->verif($DB, $this->code); + $is_dispo = $this->verif($DB, $this->code); - $i++; - } + $i++; + } - if ($is_dispo == 0) - { - return 0; - } - else - { - return -1; - } + if ($is_dispo == 0) + { + return 0; + } + else + { + return -1; + } - } + } - function verif($db, $code) - { - $sql = "SELECT code_compta FROM ".MAIN_DB_PREFIX."societe"; - $sql .= " WHERE code_compta = '".$code."'"; + function verif($db, $code) + { + $sql = "SELECT code_compta FROM ".MAIN_DB_PREFIX."societe"; + $sql .= " WHERE code_compta = '".$code."'"; - if ($db->query($sql)) - { - if ($db->num_rows() == 0) - { - return 0; - } - else - { - return -1; - } - } - else - { - return -2; - } + $resql=$db->query($sql); + if ($resql) + { + if ($db->num_rows($resql) == 0) + { + return 0; + } + else + { + return -1; + } + } + else + { + return -2; + } - } + } } ?> diff --git a/htdocs/product/stats/index.php b/htdocs/product/stats/index.php index c09b4e2ffed..31cb4715b50 100644 --- a/htdocs/product/stats/index.php +++ b/htdocs/product/stats/index.php @@ -156,13 +156,14 @@ $sql = "SELECT p.label, sum(f.qty) as sumf, sum(pr.qty) as sumpr FROM ".MAIN_DB_ $sql.=" left join ".MAIN_DB_PREFIX."facturedet as f on p.rowid = f.fk_product"; $sql.=" left join ".MAIN_DB_PREFIX."propaldet as pr on p.rowid = pr.fk_product"; $sql.=" group by p.label"; -if ($db->query($sql)) +$resql=$db->query($sql); +if ($resql) { - $num = $db->num_rows(); + $num = $db->num_rows($resql); $i = 0; while ($i < $num) { - $obj = $db->fetch_object( $i); + $obj = $db->fetch_object($resql); print ""; print ""; print ""; @@ -175,7 +176,7 @@ else { dol_print_error($db); } print "
".$obj->label."".$obj->sumf."
\n"; -$db->free(); +$db->free($resql); */ diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 06ab26f27f9..04b5f6341b3 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -331,17 +331,17 @@ class Entrepot extends CommonObject $result = $this->db->query($sql) ; $i = 0; - $num = $this->db->num_rows(); + $num = $this->db->num_rows($result); if ( $result ) { while ($i < $num) { - $row = $this->db->fetch_row($i); + $row = $this->db->fetch_row($result); $liste[$row[0]] = $row[1]; $i++; } - $this->db->free(); + $this->db->free($result); } return $liste; } diff --git a/htdocs/public/donations/donateurs_code.php b/htdocs/public/donations/donateurs_code.php index eb3c33a5f95..5befd6faecd 100644 --- a/htdocs/public/donations/donateurs_code.php +++ b/htdocs/public/donations/donateurs_code.php @@ -53,10 +53,10 @@ $sql = "SELECT d.datedon as datedon, d.nom, d.prenom, d.amount, d.public, d.soci $sql.= " FROM ".MAIN_DB_PREFIX."don as d"; $sql.= " WHERE d.fk_statut in (2, 3) ORDER BY d.datedon DESC"; -if ( $db->query( $sql) ) +$resql=$db->query($sql); +if ($resql) { - $num = $db->num_rows(); - + $num = $db->num_rows($resql); if ($num) { @@ -73,7 +73,7 @@ if ( $db->query( $sql) ) $bc[0]='bgcolor="#f0f0f0"'; while ($i < $num) { - $objp = $db->fetch_object( $i); + $objp = $db->fetch_object($resql); $var=!$var; print ""; diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index e558f88e18a..847b8040b25 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -91,7 +91,7 @@ if ($_POST["action"] == 'add') $result = $db->query($sql); if ($result) { - $num = $db->num_rows(); + $num = $db->num_rows($result); } if (!isset($_POST["nom"]) || !isset($_POST["prenom"]) || $_POST["prenom"]=='' || $_POST["nom"]=='') { diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 4562a482809..e4af6f163c3 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -93,22 +93,20 @@ class CompanyBankAccount $sql .= " WHERE fk_soc = ".$this->socid; $result = $this->db->query($sql); - if ($result) { - if ($this->db->num_rows() == 0) + if ($this->db->num_rows($result) == 0) { $this->create(); } } else { - print $this->db->error(); + dol_print_error($this->db); return 0; } $sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET "; - $sql .= " bank = '" .addslashes($this->bank)."'"; $sql .= ",code_banque='".$this->code_banque."'"; $sql .= ",code_guichet='".$this->code_guichet."'"; @@ -119,11 +117,9 @@ class CompanyBankAccount $sql .= ",domiciliation='".addslashes($this->domiciliation)."'"; $sql .= ",proprio = '".addslashes($this->proprio)."'"; $sql .= ",adresse_proprio = '".addslashes($this->adresse_proprio)."'"; - $sql .= " WHERE fk_soc = ".$this->socid; $result = $this->db->query($sql); - if ($result) { return 1; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 0a97656813b..7969300c620 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -923,18 +923,19 @@ class User extends CommonObject $sql.= " WHERE bydefault = 1"; $sql.= " AND entity = ".$conf->entity; - if ($this->db->query($sql)) + $resql=$this->db->query($sql); + if ($resql) { - $num = $this->db->num_rows(); + $num = $this->db->num_rows($resql); $i = 0; $rd = array(); while ($i < $num) { - $row = $this->db->fetch_row($i); + $row = $this->db->fetch_row($resql); $rd[$i] = $row[0]; $i++; } - $this->db->free(); + $this->db->free($resql); } $i = 0; while ($i < $num)