[ghelda-devel] [75] plugins/People: Make the formattedFields better

[ Thread Index | Date Index | More lists.tuxfamily.org/ghelda-devel Archives ]


Revision: 75
Author:   odyx
Date:     2009-07-25 01:12:30 +0200 (Sat, 25 Jul 2009)

Log Message:
-----------
plugins/People: Make the formattedFields better

Modified Paths:
--------------
    trunk/plugins/People.php


Modified: trunk/plugins/People.php
===================================================================
--- trunk/plugins/People.php	2009-07-24 23:12:28 UTC (rev 74)
+++ trunk/plugins/People.php	2009-07-24 23:12:30 UTC (rev 75)
@@ -143,7 +143,7 @@
             // Get the fields from the keyed array
             $fields = array_keys($fieldsSpec);
 
-            $formattedFields = '';
+
             // Go along the fields
             foreach($fields as $fieldName_) {
                 $fieldName = $this->name.'_'.$fieldName_;
@@ -235,10 +235,11 @@
                         continue;
                 }
                 $fieldsContents[$fieldName_] = $fieldContent;
-                $formattedFields .= "`$fieldName_` = '".$fieldContent."', ";
+                $formattedFields_array[] = "`$fieldName_` = '".$fieldContent."'";
             }
             // Strip the two last characters (border issue)
-            $formattedFields = substr($formattedFields,0,-2);
+            $formattedFields = implode($formattedFields_array,", ");
+
             // If we are updating (thus not making a new entry)
             if($id <> G_PEOPLE_ID_NEW) {
                 $query = sprintf("UPDATE `%s` SET %s WHERE `%s` = '%s' LIMIT 1",
@@ -261,7 +262,8 @@
                 // Get the just produced ID (per client => thread-safe)
                 $query = "SELECT LAST_INSERT_ID()";
                 $queryR =& $this->db->query($query);
-                $id =& current($queryR->fetchRow());
+                $id =& end($queryR->fetchRow());
+                gol('id = ',$id);
                 // Success => mode = 'edit'
                 $this->mode = 'edit';
 //          } else {    // We had errors while preparing the new user


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/