On Feb 10, 2008 1:12 PM, nihilism machine <[EMAIL PROTECTED]> wrote:

> Ok, I read the php.net info. so with this function though:
>
>        public function select_one($sql) {
>                $this->last_query = $sql;
>                $r = mysql_query($sql);
>                if (!$r) {
>                        $this->last_error = mysql_error();
>                        return false;
>                }
>                if (mysql_num_rows($r) != 1) {
>                        return false;
>                }
>                $ret = mysql_result($r, 0);
>                mysql_free_result($r);
>                if ($this->auto_slashes) {
>                        return stripslashes($ret);
>                } else {
>                        return $ret;
>                }
>        }


as the function stands you wont be able to.  you can alter it
though:

       public function select_one($sql, $columnName) {
               $this->last_query = $sql;
               $r = mysql_query($sql);
               $ret = false;                  ///  default return value is
false
               if (!$r) {
                       $this->last_error = mysql_error();
                       return false;
               }
               if (mysql_num_rows($r) != 1) {
                       return false;
               }
               $result = mysql_fetch_assoc($r);
               if(isset($result[$columnName])) {
                  $ret = $result[$columnName]);
               }
               mysql_free_result($r);
               if ($this->auto_slashes) {
                       return stripslashes($ret);
               } else {
                       return $ret;
               }
       }

note: i just hacked that together in my mail client :)

-nathan

Reply via email to