本文整理匯總了PHP中ADOdb_Active_Record::Save方法的典型用法代碼示例。如果您正苦於以下問題:PHP ADOdb_Active_Record::Save方法的具體用法?PHP ADOdb_Active_Record::Save怎麽用?PHP ADOdb_Active_Record::Save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ADOdb_Active_Record
的用法示例。
在下文中一共展示了ADOdb_Active_Record::Save方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: editarRegistro
public function editarRegistro()
{
$this->usarScaffold();
//Conectarse a la base de datos
if ($this->db == "") {
$this->db = "default";
}
$conexion = $this->nucleo->getConexion($this->db);
$conexion->Execute("SET NAMES utf8");
//Primarias en $primarias
//Demas campos en $campos
$campos = $this->getCampos();
$registro = new ADOdb_Active_Record($this->modelo);
$where = "";
foreach ($campos as $c) {
if ($c["primaria"] == 1) {
if ($where != "") {
$where .= " AND ";
}
$where .= $c["nombre"] . "=" . $this->par['pri_' . $c["nombre"]];
}
}
$registro->Load($where);
foreach ($campos as $c) {
if ($c["auto"] == 1) {
} elseif ($c["nombre"] == "password" || $c["nombre"] == "contrasena") {
if ($this->par[$c["nombre"]] != "") {
$registro->{$c}["nombre"] = md5($this->par[$c["nombre"]]);
}
} elseif ($c["nombre"] == "texto") {
$registro->{$c}["nombre"] = stripslashes($this->par[$c["nombre"]]);
} else {
$registro->{$c}["nombre"] = $this->par[$c["nombre"]];
}
}
if ($registro->Save()) {
$this->set("editado", "1");
$this->listado();
$this->set("vista", "listado");
} else {
$this->set("editado", "0");
$this->agregar();
$this->set("vista", "agregar");
}
}