예제 #1
1
 /**
  * Getting all users
  */
 public function getAllUsers()
 {
     $c = new DB_Connect();
     $d = $c->connect();
     $result = mysqli_query($d, "select * FROM gcm_users");
     return $result;
 }
예제 #2
0
 function __construct()
 {
     require_once 'include/DB_Connect.php';
     // connecting to database
     $db = new DB_Connect();
     $this->conn = $db->connect();
 }
 function __construct()
 {
     $path = elgg_get_plugins_path();
     include_once $path . 'elgg_with_rest_api/lib/DB_connect.php';
     $conn = new DB_Connect();
     $this->db = $conn->connect();
 }
 function __construct()
 {
     $path = elgg_get_plugins_path();
     include_once $path . 'web_services/lib/DB_connect.php';
     $conn = new DB_Connect();
     $this->db = $conn->connect();
 }
예제 #5
0
 public function delete()
 {
     $con = new DB_Connect();
     $con->exec('delete from test_type where test_type_id=' . JPOST('test_type_id'));
     $jTableResult = array();
     $jTableResult['Result'] = "OK";
     print json_encode($jTableResult);
 }
예제 #6
0
 function __construct()
 {
     require_once __DIR__ . '/DB_connect.php';
     // Importando clase de conexión
     // conectando...
     $db = new DB_Connect();
     $this->con = $db->getDbConnection();
     // Conectando con base de datos
 }
예제 #7
0
function updatePassword()
{
    $st_user = $_POST['st_user'];
    $st_pwd = $_POST['st_pwd'];
    $db = new DB_Connect();
    $statement = "update students set s_pwd=? where s_user=?";
    $result = $db->prepare($statement);
    $result->execute(array(md5($st_pwd), $st_user));
    echo json_encode(array('success' => $result->rowCount()));
}
예제 #8
0
 public static function getInstance($dsn = null, $username = null, $password = null)
 {
     if (!self::$instance instanceof PDO) {
         self::$instance = new PDO("{$dsn}", $username, $password);
         self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     }
     return self::$instance;
 }
 function test()
 {
     self::$connection = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("unable to connect to database");
     $db_select = mysql_select_db(DB_NAME, self::$connection);
     if (!$db_select) {
         die("Database selection failed: " . mysql_error());
     }
 }
예제 #10
0
파일: Core.php 프로젝트: Rem122/Uthando-CMS
 protected function conn()
 {
     isset($this->username);
     isset($this->password);
     if (!$this->db instanceof PDO) {
         $this->db = DB_Connect::getInstance($this->dsn, $this->username, $this->password);
     }
 }
예제 #11
0
 private function setDB()
 {
     require_once $this->root . "/class/DB_Connect.php";
     $ds = new MySQLDataSource(DB_Connect::mysql_db());
     //This $db_con link has been created inside KoolPHPSuite/Resources/runexample.php
     $ds->SelectCommand = 'select s_id, s_user, s_pwd, s_num, s_name, s_mail, s_date, s_role, s_phone, reg_date,  last_login, edu_id, edu_name, dept_name, major_name, class_name, class_id from student join class using(class_id) join major using(major_id) join department using(dept_id) join education using(edu_id) ' . $this->where_cla;
     $ds->UpdateCommand = "update student set s_pwd=md5('@s_pwd'), s_name='@s_name', s_num='@s_num' where s_id=@s_id";
     $this->grid->DataSource = $ds;
 }
예제 #12
0
 private function setDB()
 {
     require_once $this->root . "/class/DB_Connect.php";
     $ds = new MySQLDataSource(DB_Connect::mysql_db());
     //This $db_con link has been created inside KoolPHPSuite/Resources/runexample.php
     $ds->SelectCommand = "select m_id,m_user,m_name,m_pwd,department.dept_id,dept_name from manager right join department using(dept_id)";
     $ds->UpdateCommand = "update manager set m_pwd=md5('@m_pwd'), m_user='******', m_name='@m_name', dept_id='@dept_id' where m_id=@m_id";
     $ds->InsertCommand = "insert into manager (m_user, m_pwd, m_name, dept_id) values('@m_user',md5('@m_pwd'), '@m_name', '@dept_id')";
     $ds->DeleteCommand = "delete from manager where m_id=@m_id";
     $this->grid->DataSource = $ds;
 }
예제 #13
0
 public function __construct($s_user)
 {
     $db = new DB_Connect();
     $column = 'a.s_user, a.s_num, a.s_pwd, a.s_name, a.s_mail, a.s_phone, a.s_date, a.test_type_id, d.dept_name, d.id dept_id, c.major_name, c.id major_id,
         b.class_name, b.id class_id, a.score_1, a.score_2, a.score_3, a.score_ans, a.score_type, a.reg_date, a.s_role, e.edu_name, e.edu_id ';
     $from_clause = 'from students a left join classes b on a.class_id=b.id 
         left join majors c on b.major_id=c.id 
         left join departments d on c.department_id=d.id 
         left join educations e on a.edu_id= e.edu_id ';
     $where_clause = 'where a.state=1 and a.s_user=:s_user';
     $statement = 'select ' . $column . $from_clause . $where_clause;
     $result = $db->prepare($statement);
     $result->execute(array(':s_user' => $s_user));
     if ($row = $result->fetch()) {
         $this->s_user = $row['s_user'];
         $this->s_num = $row['s_num'];
         $this->s_pwd = $row['s_pwd'];
         $this->s_name = $row['s_name'];
         $this->s_mail = $row['s_mail'];
         $this->s_date = $row['s_date'];
         $this->dept_name = $row['dept_name'];
         $this->major_name = $row['major_name'];
         $this->class_name = $row['class_name'];
         $this->score_1 = $row['score_1'];
         $this->score_2 = $row['score_2'];
         $this->score_3 = $row['score_3'];
         $this->score_ans = $row['score_ans'];
         $this->score_type = $row['score_type'];
         $this->reg_date = $row['reg_date'];
         $this->s_role = $row['s_role'];
         $this->edu_name = $row['edu_name'];
         $this->s_phone = $row['s_phone'];
         $this->dept_id = $row['dept_id'];
         $this->major_id = $row['major_id'];
         $this->class_id = $row['class_id'];
         $this->edu_id = $row['edu_id'];
         $this->test_type_id = $row['test_type_id'];
     } else {
     }
 }
 public function __construct($dbo = NULL, $useDate = NULL)
 {
     parent::__construct($dbo);
     if (isset($userDate)) {
         $this->_userDate = $userDate;
     } else {
         $this->_userDate = date('Y-m-d H:i:s');
     }
     $ts = strtotime($this->_useDate);
     $this->_m = date('m', $ts);
     $this->_y = date('y', $ts);
     $this->_daysInMonth = cal_days_in_month(CAL_GREGORIAN, $this->_m, $this->_y);
     $ts = mktime(0, 0, 0, $this->_m, 1, $this->_y);
     $this->_startDay = date('w', $ts);
 }
예제 #15
0
파일: dbinit.php 프로젝트: sdn-ixp/iSDX
<?php

/*##############################################
# Hawkeye POC Portal                          #
# Author: Ankita Pawar (ankita.pawar@emc.com) #
###############################################*/
require_once __DIR__ . '/include/db_connect.php';
print_r("DB_HOST=" . DB_HOST . "<br> ");
print_r("DB_USER="******"<br> ");
print_r("DB_PASSWORD="******"<br> ");
print_r("DB_DATABASE=" . DB_DATABASE . "<br> ");
print_r("DB_PORT=" . DB_PORT . "<br> <br>");
$db = new DB_Connect();
$db->connect();
$sql = "create table user( ID int NOT NULL AUTO_INCREMENT, name text, email text, password text, PRIMARY KEY (ID))";
mysql_unbuffered_query($sql);
$sql = "create table array( ID int NOT NULL AUTO_INCREMENT, name text, serial_no text, PRIMARY KEY (ID))";
mysql_unbuffered_query($sql);
$sql = "create table requests( ID int NOT NULL AUTO_INCREMENT, system_id text, cmd text, type text, status text, PRIMARY KEY (ID))";
mysql_unbuffered_query($sql);
$sql = "create table cpu_stat(ID int NOT NULL AUTO_INCREMENT, ts datetime, spa int, spb int, serial text, PRIMARY KEY (ID))";
mysql_unbuffered_query($sql);
$sql = "create table iops_stat(ID int NOT NULL AUTO_INCREMENT, ts datetime, spa_read int, spa_write int, spb_read int, spb_write int, serial text, PRIMARY KEY (ID))";
mysql_unbuffered_query($sql);
$sql = "create table capacity_stat(ID int NOT NULL AUTO_INCREMENT, ts datetime, syscap int, usedcap int, freecap int, unconfigcap int, serial text, PRIMARY KEY (ID))";
mysql_unbuffered_query($sql);
$sql = "create table healthcheck (ID int NOT NULL AUTO_INCREMENT, ts datetime, score int, serial text, note text, PRIMARY KEY (ID))";
mysql_unbuffered_query($sql);
// Insert data in array table for poc
$sql = "select * from array where serial_no = 'APM00143230622'";
$query = mysql_query($sql);
예제 #16
0
 public function getAll()
 {
     return parent::getArray("SELECT `edu_id`, `edu_name` FROM `educations` where state=1");
 }
예제 #17
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
include "header.php";
include_once "control.php";
$db = new DB_Connect();
$staff = $db->get_staff();
$jobs = $db->get_jobs();
?>
    <div class="container">
        <div class="row" >
        	<div class="col-xs-12">
        	    <div class="well" id="intro_text">
    
    	Record your work here and increase your efficiency!
    
    </div>
    </div>
    </div>
        
        <div class="row">
      	
  <div class="col-md-3">   
  
      <div id="staff_box">
      					<div id="page_heading"><span id="span_title"></span>Time Sheet<br/></div>
                        Employee <select id="staff_member">
      <option value="">Please select...</option>
                                    <?php 
foreach ($staff as $staffer) {
예제 #18
0
<?php

include_once "control.php";
$db = new DB_Connect();
if (isset($_POST["start_job"]) && $_POST["start_job"]) {
    $data = array("job_id" => $_POST['job'], "staff" => $_POST['staff'], "desc" => $_POST['desc'], "jobCat" => $_POST['Job_Category']);
    echo $db->save_start($data);
    exit;
}
if (isset($_POST["end_job"]) && $_POST["end_job"]) {
    $data = array("taskID" => $_POST['taskID']);
    echo $db->save_end($data);
    exit;
}
if (isset($_POST["get_staff"]) && $_POST["get_staff"]) {
    echo json_encode($db->get_staff());
    exit;
}
if (isset($_POST["get_jobs"]) && $_POST["get_jobs"]) {
    echo json_encode($db->get_jobs());
    exit;
}
if (isset($_POST['update_job']) && $_POST['update_job']) {
    $data = array("id" => $_POST["id"], "job_id" => $_POST['job_id'], "client" => $_POST['client'], "job_name" => $_POST['job_name'], "quoted_cost" => $_POST['quoted_cost']);
    echo $db->update_job($data);
    exit;
}
예제 #19
0
 private function _get_popular_categories($page_slug)
 {
     $category_array = array();
     try {
         $sql = "SELECT `tags`\n                    FROM `" . DB_NAME . "`.`" . DB_PREFIX . "entries`\n                        WHERE `page_id`=(\n                            SELECT `page_id`\n                            FROM `" . DB_NAME . "`.`" . DB_PREFIX . "pages`\n                                WHERE `page_slug`=:page_slug\n                                LIMIT 0, 1\n                        )";
         $stmt = DB_Connect::create()->db->prepare($sql);
         $stmt->bindParam(':page_slug', $page_slug, PDO::PARAM_STR);
         $stmt->execute();
         $categories_array = $stmt->fetchAll(PDO::FETCH_OBJ);
         foreach ($categories_array as $categories) {
             $temp_array = explode(',', strtolower($categories->tags));
             foreach ($temp_array as $category) {
                 if (empty($category)) {
                     continue;
                 }
                 $c = str_replace(' ', '-', trim($category));
                 if (array_key_exists($c, $category_array)) {
                     $category_array[$c] += 1;
                 } else {
                     $category_array[$c] = 1;
                 }
             }
         }
         $stmt->closeCursor();
     } catch (Exception $e) {
         ECMS_Error::log_exception($e);
     }
     arsort($category_array);
     return $category_array;
 }
예제 #20
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
include_once "control.php";
$db = new DB_Connect();
$staff = $db->get_staff();
//print_r($_POST);
if (isset($_POST['export_times']) && $_POST['export_times']) {
    $start = $_POST['start'] . " 00:00:00";
    $end = $_POST['end'] . " 23:59:59";
    $staff = $_POST['staff'];
    $timeSheet = $db->export_times($start, $end, $staff);
    $output = fopen("php://output", 'w') or die("Can't open php://output");
    header("Content-Type:application/csv;charset=utf-8;");
    header("Content-Disposition:attachment;filename=Timesheet.csv;");
    fputcsv($output, array('Task ID', 'Job No', 'Client', 'Job Category', 'Staff Member', 'Description', 'Start', 'End', 'Time'));
    foreach ($timeSheet as $product) {
        $s = strtotime($product['start']);
        $e = strtotime($product['end']);
        $d = abs($s - $e);
        $product['time'] = sprintf('%02d:%02d:%02d', $d / 3600, $d / 60 % 60, $d % 60);
        fputcsv($output, $product);
    }
    fclose($output) or die("Can't close php://output");
    exit;
}
include "header.php";
?>
 <div class="container">
        <div class="row" >
<?php

include 'inc/class.PassHash.inc.php';
include 'inc/class.db_connect.inc.php';
$checkedFormsFields = checkFormField::cleanFormField($_POST);
DB_Connect::test();
if (isset($checkedFormsFields['save'])) {
    $today = date("Ymd");
    $query = 'insert into users (username, pass, name, firstName, lastName, regDate) values ("' . $checkedFormsFields['username'] . '", "' . PassHash::hash($checkedFormsFields['password']) . '", "' . $checkedFormsFields['name'] . '", "' . $checkedFormsFields['firstName'] . '", "' . $checkedFormsFields['lastName'] . '", "' . $today . '")';
    $result = DB_Connect::query($query);
    if ($result == 1) {
        header('Location: index.php');
    }
} else {
    $query = 'select * from users where username = "******"';
    $result = DB_Connect::query($query);
    $fila = mysql_fetch_assoc($result);
    if ($checkedFormsFields['validateUsername']) {
        echo json_encode($fila);
    } else {
        if (PassHash::check_password($fila["pass"], $checkedFormsFields['password'])) {
            header('Location: success.php');
        }
    }
}
예제 #22
0
function Register()
{
    $birth = (string) $_POST['st_birth'];
    $birth = substr($birth, 6, 4) . '-' . substr($birth, 0, 2) . '-' . substr($birth, 3, 2);
    $param = array(':st_user' => (string) $_POST['st_user'], ':st_pwd' => md5((string) $_POST['st_pwd']), ':st_name' => (string) $_POST['st_name'], ':st_no' => (string) $_POST['st_no'], ':st_mail' => (string) $_POST['st_mail'], ':st_depart' => (string) $_POST['st_depart'], ':st_major' => (string) $_POST['st_major'], ':st_class' => (string) $_POST['st_class'], ':st_grade' => (string) $_POST['st_grade'], ':st_birth' => $birth, ':reg_date' => date('y-m-d', time()), ':st_edu' => intval($_POST['st_edu']));
    $db = new DB_Connect();
    $column = 's_user, s_num, s_pwd, dept_id, s_name, s_mail, s_date, class_id, major_id, reg_date, edu_id, s_grade';
    $statement = 'insert into student(' . $column . ') values(:st_user,:st_no,:st_pwd,:st_depart,:st_name,:st_mail,:st_birth,
        :st_class,:st_major,:reg_date,:st_edu,:st_grade)';
    $result = $db->prepare($statement);
    $result->execute($param);
    echo json_encode(array('flag' => $result->rowCount()));
}
예제 #23
0
for ($i = $s_role; $i <= $s_role_to; $i++) {
    $testBox[$i] = new KoolListBox("testBox_" . $i);
    $testBox[$i]->id = "testBox_{$i}";
}
//    <div style='clear:both'></div>
foreach ($testBox as $box) {
    $box->AllowTransferOnDoubleClick = true;
    $box->Width = "300px";
    $box->Height = "490px";
    $box->styleFolder = "default";
    $box->AllowMultiSelect = true;
}
$testBox[$s_role]->TransferToId = "testBox_{$s_role_to}";
$testBox[$s_role]->ButtonSettings->ShowTransfer = true;
$testBox[$s_role]->ButtonSettings->ShowTransferAll = true;
$db = new DB_Connect();
$sth = $db->prepare($sel);
$sth->execute();
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
    $role = (int) $row['s_role'];
    $item = new ListBoxItem();
    $item->Data = array("s_name" => $row['s_name'], "s_num" => $row['s_num'], "s_id" => $row['s_id']);
    $testBox[$role]->AddItem($item);
}
foreach ($testBox as $box) {
    $box->ItemTemplate = "<div class='student_list_item' id='{s_id}'>姓名:<strong>{s_name}</strong><label id='noLabel'>学号:<strong>{s_num}</strong></label></div>";
    $box->Init();
    echo "<div style='padding:20px;float:left;'>";
    echo $box->Render();
    echo "</div>";
}
예제 #24
0
 public function getRandAns($test_type_id = -1, $que_of_num = 60)
 {
     $sql = "select * from question where q_type=2 ";
     if ($test_type_id != -1) {
         $sql .= " and test_type_id={$test_type_id}";
     }
     $sth = parent::prepare($sql);
     $sth->execute();
     $res_all = $sth->fetchAll();
     $res_rand = array();
     $pid_num = count($res_all);
     $temp = array();
     if ($pid_num < $que_of_num) {
         $que_of_num = $pid_num;
     }
     for ($i = 0; $i < $que_of_num; $i++) {
         $rand_num = rand(0, $pid_num - $i - 1);
         $res_rand[$i] = $res_all[$rand_num];
         $temp = $res_all[$rand_num];
         $res_all[$rand_num] = $res_all[$pid_num - $i - 1];
         $res_all[$pid_num - $i - 1] = $temp;
     }
     return $res_rand;
 }
예제 #25
0
<?php

set_time_limit(0);
require 'class/xmlrpc.php';
require "instaconnect.php";
include 'class/api.php';
require_once '/home/golive/public_html/class/db.cls.php';
$db = new DB_Connect(MYSQL_INSTACONNECT, true);
$db->log_type = MYSQL_INSTACONNECT;
if (isset($HTTP_RAW_POST_DATA)) {
    $rxml = $HTTP_RAW_POST_DATA;
} else {
    $rxml = implode("\r\n", file('php://input'));
}
#192.168.0.1
#Gol1v3inc5002012
$host = '50.17.202.43';
$username = '******';
$password = '******';
$dbms = 'asteriskvoip';
/*mysql_connect($host,$username,$password) or die ('Error connecting to mysql');
mysql_select_db($dbms); */
$db_voip = new mysqli($host, $username, $password, $dbms);
#$dbserver = "10.10.26.134";
$dbserver = "cluster-db.crfsqbh1kkpg.us-west-2.rds.amazonaws.com";
$dbuser = "******";
$dbpass = "******";
$dbdata = "voicechanger_web";
$db2 = new mysqli($dbserver, $dbuser, $dbpass, $dbdata);
$rxml = urldecode($rxml);
$db->logfile("voicechanger; {$rxml} ;");
예제 #26
0
function Register()
{
    $birth = (string) $_POST['st_birth'];
    //$birth = substr($birth,6,4).'-'.substr($birth,0,2).'-'.substr($birth,3,2);
    $param = array($_POST['st_user'], $_POST['st_no'], md5($_POST['st_pwd']), $_POST['st_name'], $_POST['st_mail'], $_POST['st_phone'], $birth, $_POST['st_class'], date('y-m-d', time()), intval($_POST['st_edu']), $_POST['st_grade']);
    $db = new DB_Connect();
    $column = 's_user, s_num, s_pwd, s_name, s_mail, s_phone, s_date, class_id, reg_date, edu_id, s_grade';
    $statement = 'insert into students(' . $column . ') values(?,?,?,?,?,?,?,?,?,?,?)';
    $result = $db->prepare($statement);
    $result->execute($param);
    echo json_encode(array('flag' => $result->rowCount()));
}
예제 #27
0
<?php

if (isset($_POST['submit'])) {
    include_once 'db_functions.php';
    $db = new DB_Functions();
    $email = "test";
    $i = 0;
    $regId = array();
    $msg = array();
    $message = $_POST["message"];
    include_once './gcm.php';
    $gcm = new GCM();
    $c = new DB_Connect();
    $d = $c->connect();
    $res = mysqli_query($d, "SELECT * FROM gcm_users WHERE email = '{$email}'") or die(mysql_error());
    while ($row = mysqli_fetch_array($res)) {
        $regId[$i] = $row["gcm_regid"];
        $msg[$i] = $message;
        $i = $i + 1;
    }
    for ($j = 0; $j < sizeof($regId); $j = $j + 1) {
        $registatoin_ids = array($regId[$j]);
        $message = array("price" => $msg[$j]);
        $result = $gcm->send_notification($registatoin_ids, $message);
        echo $result;
    }
}
예제 #28
0
<?php

include "header.php";
include_once "control.php";
$db = new DB_Connect();
if ($_POST['add_a_job']) {
    $data = array("job_id" => $_POST['jobid'], "client" => $_POST['client'], "job_name" => $_POST['jobname'], "quoted_cost" => $_POST['quoted']);
    // print_r($data);
    if ($db->add_job($data)) {
        echo '<div class="alert alert-success" role="alert">' . $_POST['jobid'] . ' added sucessfully</div>';
    } else {
        echo '<div class="alert alert-danger" role="alert">failed to add job ' . $_POST['jobid'] . '</div>';
    }
}
?>
<div id="" class="container">

	<div id="heading">

	<h1>Create a new job</h1>

	</div>

	<div id="timesheet" class="row">
        <form method="post" action="">
    	<div id="job_id" class="col-xs-1">        
        	<input placeholder="Job No." type="text" name="jobid">            
        </div>        
        <div id="client_name" class="col-xs-2">        
        	<input placeholder="Client" type="text" name="client">                   
        </div>        
예제 #29
0
파일: createLUNs.php 프로젝트: sdn-ixp/iSDX
require_once __DIR__ . '/include/util.inc';
require_once __DIR__ . '/include/db_connect.php';
require_once '/home/vcap/app/lib/vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPConnection;
use PhpAmqpLib\Message\AMQPMessage;
//header('Content-type: text/html');
header('Access-Control-Allow-Origin: *');
$services = getenv('VCAP_SERVICES');
$json = json_decode($services, TRUE);
$hostname = $json['p-rabbitmq'][0]['credentials']['protocols']['amqp']['host'];
$user = $json['p-rabbitmq'][0]['credentials']['protocols']['amqp']['username'];
$password = $json['p-rabbitmq'][0]['credentials']['protocols']['amqp']['password'];
$port = $json['p-rabbitmq'][0]['credentials']['protocols']['amqp']['port'];
$vhost = $json['p-rabbitmq'][0]['credentials']['protocols']['amqp']['vhost'];
$db = new DB_Connect();
$db->connect();
$system_id = string_escape(util_aiod($_POST, 'ID', ""));
$name = string_escape(util_aiod($_POST, 'name', ""));
$type = 'Thin';
$capacity = string_escape(util_aiod($_POST, 'capacity', ""));
$offset = 0;
$sq = 'gb';
$pool_id = '0';
$sp = string_escape(util_aiod($_POST, 'sp', ""));
$auto_assignment = '1';
$tiering_policy = 'autoTier';
$initial_tier = 'highestAvailable';
$cmd = "naviseccli lun -create -type  " . $type . " -capacity " . $capacity . " -sq " . $sq . " -poolId " . $pool_id . " -sp " . $sp . "  -aa " . $auto_assignment . " -name " . $name . " -offset " . $offset . " -tieringPolicy " . $tiering_policy . " -initialTier " . $initial_tier;
$result = mysql_query("INSERT INTO `requests` (system_id, cmd, type, status) values ('{$system_id}', '{$cmd}', 'create_lun', 'N');");
$tuple_id = mysql_insert_id();
예제 #30
0
function getMessageTypeToSelect()
{
    $db = new DB_Connect();
    $statement = "select * from information_types";
    $result = $db->prepare($statement);
    $result->execute();
    $first = 1;
    $ret = "";
    while ($row = $result->fetch()) {
        $ret = $ret . "<option value='" . $row['id'] . "'>" . $row['name'] . "</option>";
    }
    echo json_encode(array('content' => $ret));
}