phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] property/inc class.socommon.inc.php


From: Sigurd Nes
Subject: [Phpgroupware-cvs] property/inc class.socommon.inc.php
Date: Mon, 09 Oct 2006 17:20:39 +0000

CVSROOT:        /sources/phpgroupware
Module name:    property
Changes by:     Sigurd Nes <sigurdne>   06/10/09 17:20:39

Modified files:
        inc            : class.socommon.inc.php 

Log message:
        fix next_id

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.socommon.inc.php?cvsroot=phpgroupware&r1=1.28&r2=1.29

Patches:
Index: class.socommon.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.socommon.inc.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- class.socommon.inc.php      6 Oct 2006 08:33:25 -0000       1.28
+++ class.socommon.inc.php      9 Oct 2006 17:20:39 -0000       1.29
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage core
-       * @version $Id: class.socommon.inc.php,v 1.28 2006/10/06 08:33:25 
sigurdne Exp $
+       * @version $Id: class.socommon.inc.php,v 1.29 2006/10/09 17:20:39 
sigurdne Exp $
        */
 
        /**
@@ -258,6 +258,14 @@
                        return $district;
                }
 
+               /**
+               * Finds the next ID for a record at a table
+               * 
+               * @param string $table tablename in question
+               * @param array $key conditions
+               * @return int the next id
+               */
+
                function next_id($table='',$key='')
                {
                        $where = '';
@@ -267,19 +275,18 @@
                                {
                                        if($value)
                                        {
-                                               $condition[] = $column . '=' . 
$value;
+                                               $condition[] = $column . "='" . 
$value;
                                        }
                                }
 
-                               $where=' WHERE ' . implode(" AND ", $condition);
+                               $where='WHERE ' . implode("' AND ", $condition) 
. "'";
                        }
 
-                       $this->db->query("SELECT max(id) as maximum FROM $table 
$where",__LINE__,__FILE__);
-                       $this->db->next_record();
-                       $next_id = $this->db->f('maximum')+1;
-                       return "$next_id";
+                       $this->db2->query("SELECT max(id) as maximum FROM 
$table $where",__LINE__,__FILE__);
+                       $this->db2->next_record();
+                       $next_id = $this->db2->f('maximum')+1;
+                       return $next_id;
                }
-
                function get_lookup_entity($location)
                {
                        $this->db->query("SELECT entity_id,name FROM 
fm_entity_lookup $this->join fm_entity on 
fm_entity_lookup.entity_id=fm_entity.id WHERE type='lookup' AND 
location='$location'  ");




reply via email to

[Prev in Thread] Current Thread [Next in Thread]