Пример #1
0
     $db = $_REQUEST['db'];
     $dbConnection = mysql_connect($host, $user, $password) or $checkDatabaseConnection = false;
     if ($checkDatabaseConnection) {
         mysql_select_db($db) or $checkDatabaseConnection = false;
     }
     jecho($checkDatabaseConnection);
     break;
     /**
      * Retrieving users from db
      */
 /**
  * Retrieving users from db
  */
 case "get-users":
     $success = true;
     $sql = $QUERIES->getUsers();
     $users = array();
     if ($checkDatabaseConnection) {
         $result = mysql_query($sql) or $success = false;
         if ($success) {
             while ($row = mysql_fetch_array($result)) {
                 $user = new stdClass();
                 $user->id = $row["userid"];
                 $user->name = $row["name"];
                 $user->password = $row["password"];
                 array_push($users, $user);
             }
         }
     }
     jecho($users);
     break;