本文整理汇总了PHP中bd::lastInsertId方法的典型用法代码示例。如果您正苦于以下问题:PHP bd::lastInsertId方法的具体用法?PHP bd::lastInsertId怎么用?PHP bd::lastInsertId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bd
的用法示例。
在下文中一共展示了bd::lastInsertId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cleanMessage
}
$message = cleanMessage($_POST['message'], $max_chars, $userid);
if (!is_numeric($message) || $message > 5) {
$fields = array('userid' => $userid, 'message' => $message, 'img' => $img, 'time_start' => $_POST['time_start'], 'time_end' => $_POST['time_end'], 'days' => $_POST['days'], 'hour' => $_POST['hour'], 'publish_fb' => $_POST['publish_fb'], 'publish_tw' => $_POST['publish_tw'], 'publish_fbp' => $_POST['publish_fbp'], 'publish_fbgp' => $_POST['publish_group']);
if (is_array($fields = makeTimes($fields))) {
if ($_POST['edit'] == true) {
unset($fields['userid']);
if ($hdb->doUpdate($table, $fields, " id=" . $hdb->quote($_POST['mes_id']) . " AND userid=" . $hdb->quote($userid))) {
$return = array("e" => 0, "c" => array("i" => $_POST['mes_id'], "m" => $fields['message'], "p" => $fields['img'], "ts_es" => formatTimeStamp($fields['time_start']), "ts_en" => date('Y-m-d', $fields['time_start']), "te_es" => formatTimeStamp($fields['time_end']), "te_en" => date('Y-m-d', $fields['time_end']), "t_p" => $fields['img'], "d" => $fields['days'], "h" => formatHour($fields['hour']), "tw" => $fields['publish_tw'], "fb" => $fields['publish_fb'], "fbp" => $fields['publish_fbp'], "gp" => $fields['publish_fbgp']));
} else {
error_log($hdb->errorInfo());
$return = array("e" => 2);
}
} else {
if ($hdb->doInsert($table, $fields)) {
$return = array("e" => 0, "c" => array("i" => $hdb->lastInsertId(), "m" => $fields['message'], "p" => $fields['img'], "ts_es" => formatTimeStamp($fields['time_start']), "ts_en" => date('Y-m-d', $fields['time_start']), "te_es" => formatTimeStamp($fields['time_end']), "te_en" => date('Y-m-d', $fields['time_end']), "t_p" => $fields['img'], "d" => $fields['days'], "h" => formatHour($fields['hour']), "tw" => $fields['publish_tw'], "fb" => $fields['publish_fb'], "fbp" => $fields['publish_fbp'], "gp" => $fields['publish_fbgp']));
} else {
error_log($hdb->errorInfo());
$return = array("e" => 2);
}
}
} else {
$return = array("e" => $fields);
}
} else {
$return = array("e" => $message);
}
} else {
$return = array("e" => 1);
}
} else {
示例2: volveraPublicar
public function volveraPublicar($parametros)
{
$bd = new bd();
$parametros["descripcion"] = $this->descripcion;
$parametros["dias_garantia"] = $this->dias_garantia;
$parametros["dafactura"] = $this->dafactura;
$parametros["estienda"] = $this->estienda;
$parametros["visitas_publicaciones_id"] = $this->visitas_publicaciones_id;
$parametros["usuarios_id"] = $this->usuarios_id;
$parametros["condiciones_publicaciones_id"] = $this->condiciones_publicaciones_id;
$parametros["monto"] = $this->monto;
$parametros["clasificados_id"] = $this->clasificados_id;
$parametros["vencimientos_publicaciones_id"] = $this->vencimientos_publicaciones_id;
$parametros["titulo"] = ucwords(strtolower($parametros["titulo"]));
$result = $bd->doInsert($this->table, $parametros);
if ($result) {
$ultimoId = $bd->lastInsertId();
$tiempo = date("Y-m-d H:i:s", time());
$bd->doInsert("publicaciones_montos", array("fecha" => $tiempo, "monto" => $parametros["monto"], "publicaciones_id" => $ultimoId));
$bd->doInsert("publicacionesxstatus", array("fecha" => $tiempo, "publicaciones_id" => $ultimoId, "status_publicaciones_id" => 1));
$fotos = $bd->doFullSelect("fotosxpublicaciones", "publicaciones_id={$this->id}", "fotos_id");
foreach ($fotos as $f) {
$bd->doInsert("fotosxpublicaciones", array("fotos_id" => $f['fotos_id'], "publicaciones_id" => $ultimoId));
}
return $result;
}
}
示例3: crearFotoPort
public function crearFotoPort($id_usuario, $dataurl)
{
$bd = new bd();
if (substr($dataurl, 0, 4) == "data") {
$this->ruta = $this->crearRuta();
$result = $bd->doInsert($this->table, array("id" => 0, "ruta" => substr($this->ruta, strpos($this->ruta, "/") + 1)));
if ($result) {
$this->id = $bd->lastInsertId();
$bd->doInsert($this->table_user, array("status" => "P", "usuarios_id" => $id_usuario, "fotos_id" => $this->id));
// fotos de portada se agregan con el estado PA (portada activa)
$this->subirFoto($dataurl);
return true;
} else {
return false;
}
}
}
示例4: usuario
$bd->emptyTable("fotos");
$bd->emptyTable("usuarios");
$usuario = new usuario();
$foto = new fotos();
$i = 0;
foreach ($naturales as $natural) {
echo $usuario->datosUsuario($natural["direccion"], $natural["telefono"], $natural["descripcion"], rand(1, 24));
echo $usuario->datosNatural($natural["identificacion"], $natural["nombre"], $natural["apellido"], $natural["tipo"]);
echo $usuario->datosAcceso(strtolower($natural["nombre"] . "_" . $natural["apellido"]), $natural["email"], $natural["nombre"] . $natural["apellido"]);
echo $usuario->datosStatus();
echo showResult($usuario->crearUsuario());
if (rand(0, 1) == 0 and $i <= 100) {
$i++;
$ruta = $foto->crearRuta();
echo $bd->doInsert("fotos", array("id" => $i, "ruta" => substr($ruta, strpos($ruta, "/") + 1)));
$fotoid = $bd->lastInsertId();
echo $bd->doInsert("fotos_usuarios", array("status" => "A", "usuarios_id" => $usuario->id, "fotos_id" => $fotoid));
}
}
foreach ($juridicos as $juridico) {
echo $usuario->datosUsuario($juridico["direccion"], $juridico["telefono"], $juridico["descripcion"], rand(1, 24));
echo $usuario->datosJuridico($juridico["rif"], $juridico["razon_social"], $juridico["tipo"], rand(1, 40));
echo $usuario->datosAcceso($juridico["rif"], $juridico["email"], $juridico["rif"]);
echo $usuario->datosStatus();
echo showResult($usuario->crearUsuario());
if (rand(0, 1) == 0 and $i <= 100) {
$i++;
$ruta = $foto->crearRuta();
$bd->doInsert("fotos", array("id" => $i, "ruta" => substr($ruta, strpos($ruta, "/") + 1)));
$fotoid = $bd->lastInsertId();
echo $bd->doInsert("fotos_usuarios", array("status" => "A", "usuarios_id" => $usuario->id, "fotos_id" => $fotoid));
示例5: json_encode
$db = new bd();
$table = "manager_fb_acc";
$condition = " userid=" . $userid . " AND expired=0 AND (expires_at>" . time() . " OR expires_at=0) ";
if ($result = $db->doSingleSelect($table, $condition)) {
$table = "manager_fbp_acc";
$condition = " userid=" . $userid;
if ($db->doSingleSelect($table, $condition)) {
$return = array("e" => 2);
} else {
try {
$fbh = new Handler_Facebook();
$at = $result['access_token'];
$timezone = $result['timezone'];
if ($page = getPage($fbh, $at, $fpid)) {
$fields = array('userid' => $userid, 'user_id' => $fpid, 'name' => $page['n'], 'access_token' => $page['at'], 'expired' => 0, 'timezone' => $timezone, 'img' => $page['p'], 'last_update' => time());
if ($db->doInsert($table, $fields)) {
$return = array("e" => 0, "i" => $db->lastInsertId(), "n" => $page['n'], "p" => $page['p']);
} else {
$return = array("e" => 6);
}
} else {
$return = array('e' => 3);
}
} catch (Exception $e) {
$return = array('e' => 3);
}
}
} else {
$return = array('e' => 1);
}
echo json_encode($return);
示例6: crearUsuario
public function crearUsuario()
{
if (isset($this->n_identificacion) xor isset($this->j_rif)) {
if (isset($this->a_seudonimo)) {
$bd = new bd();
$result = $bd->doInsert($this->u_table, $this->serializarDatos("u_"));
if ($result == true) {
$result = 0;
$this->id = $bd->lastInsertId();
$hnsc = new Handler_NewSocialConnection();
if ($red_social = $hnsc->returnTableAndBody($this->id)) {
if (!$bd->doInsert($red_social['table'], $red_social['fields'])) {
error_log('Error occurred:' . implode(":", $bd->errorInfo()));
}
}
if (isset($this->n_identificacion)) {
$result += $bd->doInsert($this->n_table, $this->serializarDatos("n_", $this->u_table));
} else {
$result += $bd->doInsert($this->j_table, $this->serializarDatos("j_", $this->u_table));
}
$result += $bd->doInsert($this->a_table, $this->serializarDatos("a_", $this->u_table));
$result += $bd->doInsert($this->s_table, $this->serializarDatos("s_", array($this->s_f_table, $this->u_table)));
if ($result >= 3) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
throw new Exception("Error Usuario 004: No se han definido datos de acceso");
}
} else {
throw new Exception("Error Usuario 003: No se han definido datos Juridicos o Naturales");
}
}