X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=mw%2Fapp%2Fdata%2Fimpl%2Fmw_mysql.php;h=991ac4d6164bd045f6d592ee4c25011c652f3df0;hb=4bc0f6efc262d712b5c6f09375548bf17cd1576d;hp=0cff0c20bf5cccd3d1c6bc4fc0bae891be7c4115;hpb=dd547a56fc147a8a8b482c51a4f241d1ccbb62cb;p=mtweb diff --git a/mw/app/data/impl/mw_mysql.php b/mw/app/data/impl/mw_mysql.php index 0cff0c2..991ac4d 100644 --- a/mw/app/data/impl/mw_mysql.php +++ b/mw/app/data/impl/mw_mysql.php @@ -48,6 +48,17 @@ return false; } + function field_exists($table_name, $field_name){ + if(!$this->link) $this->connect($this->host, $this->base, $this->user, $this->password); + $sql = "SHOW COLUMNS FROM `".$table_name."` LIKE ".$field_name; + $rst = $this->query($sql); + $exists = false; + $v_rst = $this->fetch_assoc($rst); + if($v_rst) $exists = true; + $this->free_result($rst); + return $exists; + } + function query($query_string){ if(!$this->link) $this->connect($this->host, $this->base, $this->user, $this->password); $result = @mysql_query($query_string, $this->link);