当前位置: 首页>>代码示例>>PHP>>正文


PHP DbHandler::insertIntoTable方法代码示例

本文整理汇总了PHP中DbHandler::insertIntoTable方法的典型用法代码示例。如果您正苦于以下问题:PHP DbHandler::insertIntoTable方法的具体用法?PHP DbHandler::insertIntoTable怎么用?PHP DbHandler::insertIntoTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DbHandler的用法示例。


在下文中一共展示了DbHandler::insertIntoTable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

 $id_exists = $db->getOneRecord("select teamleadid from teamleadid where teamleadid='{$teamleadid}'");
 $isUserExists = $db->getOneRecord("select 1 from users where email='{$email}'");
 if (!$isUserExists && ($id_exists || $role == 'team_member') && $role != 'admin') {
     $r->customer->password = passwordHash::hash($password);
     $tabble_name = "users";
     $column_names = array('work_phone', 'mobile_phone', 'name', 'email', 'password', 'address', 'DOB', 'role', 'teamleadid', 'teamname', 'companyname', 'active');
     $result = $db->insertIntoTable($r->customer, $column_names, $tabble_name);
     if ($result != NULL) {
         $db = new DbHandler();
         $key = $name . $email;
         $key = md5($key);
         $confirm_tabble_name = "confirm";
         $confirm_column_names = array('id', 'validation_key', 'email');
         $content = array('id' => 'NULL', 'validation_key' => $key, 'email' => $email);
         $object = json_decode(json_encode($content), FALSE);
         $plz = $db->insertIntoTable($object, $confirm_column_names, $confirm_tabble_name);
         $response["status"] = "success";
         $response["message"] = "User account created successfully. Check email for validation.";
         $response["uid"] = $result;
         if (!isset($_SESSION)) {
             session_start();
         }
         $_SESSION['uid'] = $response["uid"];
         $_SESSION['phone'] = $work_phone;
         $_SESSION['name'] = $name;
         $_SESSION['email'] = $email;
         $_SESSION['email'] = $role;
         echoResponse(200, $response);
         $mails = new emailConfirmation();
         $mails->sendEmail($email, $name, $key);
     } else {
开发者ID:allanjeng,项目名称:Project_FTSD,代码行数:31,代码来源:authentication.php

示例2: array

    $lista = array();
    $idrol = $r->idrol;
    $lista = $r->opciones;
    $response = array();
    //
    //
    // Ejemplo de uso de un insert:
    //
    // select fn_ins_seg_opcion('Ingresa opciones', 'ingreso de opciones', 'Opciones' , 0, 1, 1)
    //
    $db = new DbHandler();
    $column_names = array('idrol', 'idopcion');
    foreach ($lista as $opcion) {
        $permiso->idrol = $idrol;
        $permiso->idopcion = $opcion->id;
        $result = $db->insertIntoTable($permiso, $column_names, 'seg_rol_opcion');
    }
    //$id = $db->get1Record("call sp_ins_seg_opcion_idRol( '$idrol', '$idopcion' )");
    if (is_null($result)) {
        $response['status'] = "info";
        $response['message'] = 'No fue posible agregar los datos';
    } else {
        $response['status'] = "success";
        $response['message'] = 'Se agrego correctamente';
        $response['data'] = $result;
    }
    echoResponse(200, $response);
});
//   Opción para eliminar un registro de la tabla seg_rol_opcion
$app->get('/perD/:idopcion/:idrol', 'sessionAlive', function ($idopcion, $idrol) use($app) {
    // Recupera los datos de la forma
开发者ID:albizures,项目名称:anadie,代码行数:31,代码来源:permisos.php

示例3: array

 $response = array();
 $r = json_decode($app->request->getBody());
 verifyRequiredParams(array('email', 'name', 'password'), $r->user);
 require_once 'passwordHash.php';
 $db = new DbHandler();
 $phone = $r->user->phone;
 $name = $r->user->name;
 $email = $r->user->email;
 $address = $r->user->address;
 $password = $r->user->password;
 $isUserExists = $db->getOneRecord("select 1 from users where phone='{$phone}' or email='{$email}'");
 if (!$isUserExists) {
     $r->user->password = passwordHash::hash($password);
     $tabble_name = "users";
     $column_names = array('phone', 'name', 'email', 'password', 'city', 'address');
     $result = $db->insertIntoTable($r->user, $column_names, $tabble_name);
     if ($result != NULL) {
         $response["status"] = "success";
         $response["message"] = "User account created successfully";
         $response["uid"] = $result;
         if (!isset($_SESSION)) {
             session_start();
         }
         $_SESSION['uid'] = $response["uid"];
         $_SESSION['phone'] = $phone;
         $_SESSION['name'] = $name;
         $_SESSION['email'] = $email;
         echoResponse(200, $response);
     } else {
         $response["status"] = "error";
         $response["message"] = "Failed to create user. Please try again";
开发者ID:anankitpatil,项目名称:angular,代码行数:31,代码来源:authentication.php

示例4: array

        $response['message'] = "Update data berhasil!";
    } else {
        $response['status'] = "error";
        $response['message'] = "Maaf, update data tidak berhasil!";
    }
    $result["result"] = array($response['status'], $response['message']);
    echo json_encode($result);
});
$app->post('/tingkatan/0', function () use($app) {
    $response = array();
    $db = new DbHandler();
    $r = json_decode($app->request->getBody());
    $userlevel = $r->userlevel;
    $table_name = "userlevel";
    $column_names = array('userlevel');
    $tingkatan = $db->insertIntoTable($r, $column_names, $table_name);
    if ($tingkatan != NULL) {
        $response["status"] = "success";
        $response["message"] = "Tambah data berhasil";
    } else {
        $response['status'] = "error";
        $response['message'] = "Maaf, tambah data tidak berhasil!";
    }
    $result["result"] = array($response['status'], $response['message']);
    echo json_encode($result);
});
$app->delete('/tingkatan/:iduserlevel', function ($iduserlevel) use($app) {
    $response = array();
    $db = new DbHandler();
    $query = "delete from userlevel where iduserlevel=" . $iduserlevel;
    $tingkatan = $db->deleteRecord($query);
开发者ID:advcha,项目名称:persuratan,代码行数:31,代码来源:authentication.php


注:本文中的DbHandler::insertIntoTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。