Ajout fonction liste_array
This commit is contained in:
parent
132a9b8fe9
commit
4e651437a8
@ -1,8 +1,5 @@
|
|||||||
<?PHP
|
<?PHP
|
||||||
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* $Source$
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -18,26 +15,65 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
|
* $Id$
|
||||||
|
* $Source$
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CActioncomm {
|
class CActioncomm {
|
||||||
var $id;
|
var $id;
|
||||||
var $libelle;
|
var $libelle;
|
||||||
|
|
||||||
Function CActioncomm() {
|
Function CActioncomm($DB=0)
|
||||||
|
{
|
||||||
|
$this->db = $DB;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function fetch($db, $id) {
|
|
||||||
|
Function liste_array()
|
||||||
|
{
|
||||||
|
$ga = array();
|
||||||
|
|
||||||
|
$sql = "SELECT id, libelle FROM c_actioncomm";
|
||||||
|
$sql .= " ORDER BY id";
|
||||||
|
|
||||||
|
if ($this->db->query($sql) )
|
||||||
|
{
|
||||||
|
$nump = $this->db->num_rows();
|
||||||
|
|
||||||
|
if ($nump)
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $nump)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($i);
|
||||||
|
|
||||||
|
$ga[$obj->id] = $obj->libelle;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $ga;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $this->db->error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Function fetch($db, $id)
|
||||||
|
{
|
||||||
|
|
||||||
$sql = "SELECT libelle FROM c_actioncomm WHERE id=$id;";
|
$sql = "SELECT libelle FROM c_actioncomm WHERE id=$id;";
|
||||||
|
|
||||||
if ($db->query($sql) ) {
|
if ($db->query($sql) )
|
||||||
if ($db->num_rows()) {
|
{
|
||||||
|
if ($db->num_rows())
|
||||||
|
{
|
||||||
$obj = $db->fetch_object(0);
|
$obj = $db->fetch_object(0);
|
||||||
|
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
@ -45,7 +81,9 @@ class CActioncomm {
|
|||||||
|
|
||||||
$db->free();
|
$db->free();
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
print $db->error();
|
print $db->error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user