function JSONQuery($sql,$type=1)
{
$db = new MySQLi($this->host,$this->uid,$this->pwd,$this->dbname);
$r = $db->query($sql);
if($type == 1)
return json_encode($r->fetch_all(MYSQLI_ASSOC));
}
else
return $r;