]> projects.mako.cc - scuttle/blobdiff - includes/db/mysqli.php
Merge remote-tracking branch 'gh-takuya-o/patch-mysqli-bookmark-duplicate'
[scuttle] / includes / db / mysqli.php
index fa643c241899854a3e13001eb2a71dbb7d83468c..d2eaa9bab26a94a9556547088983767b0368fc8b 100644 (file)
@@ -46,6 +46,8 @@ class sql_db
                {
                        if (@mysqli_select_db($this->db_connect_id, $this->dbname))
                        {
                {
                        if (@mysqli_select_db($this->db_connect_id, $this->dbname))
                        {
+                               //Set utf-8
+                               mysqli_query($this->db_connect_id, 'SET CHARACTER SET utf8');
                                return $this->db_connect_id;
                        }
                }
                                return $this->db_connect_id;
                        }
                }
@@ -310,7 +312,7 @@ class sql_db
                        if ($rownum > -1)
                        {
                                @mysqli_data_seek($query_id, $rownum);
                        if ($rownum > -1)
                        {
                                @mysqli_data_seek($query_id, $rownum);
-                               $row = @mysqli_fetch_assoc($query_id);
+                               $row = @mysqli_fetch_row($query_id);
                                $result = isset($row[$field]) ? $row[$field] : false;
                        }
                        else
                                $result = isset($row[$field]) ? $row[$field] : false;
                        }
                        else
@@ -380,10 +382,10 @@ class sql_db
        }
 
        function sql_escape($msg) {
        }
 
        function sql_escape($msg) {
-               if (function_exists('mysql_real_escape_string')) {
-                       return @mysql_real_escape_string($msg, $this->db_connect_id);
+               if (function_exists('mysqli_real_escape_string')) {
+                       return @mysqli_real_escape_string($this->db_connect_id, $msg);
                } else {
                } else {
-                       return mysql_escape_string($msg);
+                       return mysqli_escape_string($this->db_connect_id, $msg);
                }               
        }
        
                }               
        }
        
@@ -400,7 +402,7 @@ class sql_db
                        {
                                $this->sql_transaction('rollback');
                        }
                        {
                                $this->sql_transaction('rollback');
                        }
-                       
+
                        trigger_error($message, E_USER_ERROR);
                }
 
                        trigger_error($message, E_USER_ERROR);
                }
 

Benjamin Mako Hill || Want to submit a patch?