本文整理匯總了PHP中Sql::addSelect方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sql::addSelect方法的具體用法?PHP Sql::addSelect怎麽用?PHP Sql::addSelect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sql
的用法示例。
在下文中一共展示了Sql::addSelect方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _crearLoad
private function _crearLoad($campos = array(), $tabla = '', $accion = '')
{
$bd = new MySQL();
$sql = new Sql();
$base = $bd->getBase();
$tabla = $base . ".{$tabla}";
$sql->addTable($tabla);
switch ($accion) {
case 'buscar':
$sql->addSelect("*");
if ($campos) {
foreach ($campos as $key => $value) {
$sql->addWhere($key . " = :" . $key);
}
}
break;
case 'guardar':
$sql->setFuncion("insert");
if ($campos) {
foreach ($campos as $key => $value) {
$sql->addSelect($key);
$sql->addValue(":" . $key);
}
}
break;
case 'eliminar':
$sql->setFuncion("delete");
if ($campos) {
foreach ($campos as $key => $value) {
$sql->addWhere($key . " = :" . $key);
}
}
break;
case 'modificar':
$sql->setFuncion("update");
if ($campos) {
foreach ($campos['select'] as $key => $value) {
$sql->addSelect($key . " = :" . $key);
}
foreach ($campos['where'] as $key => $value) {
$sql->addWhere($key . " = :" . $key);
}
}
break;
}
return $sql;
}
示例2: _crearGuardar
private function _crearGuardar()
{
$bd = new MySQL();
$sql = new Sql();
$base = $bd->getBase();
$tb = $bd->getTabla();
$tabla = $base . ".{$tb}";
$sql->addTable($tabla);
$sql->setFuncion("insert");
$sql->addSelect("dni");
$sql->addValue(":dni");
$sql->addSelect("nombre");
$sql->addValue(":nombre");
$sql->addSelect("fechaAlta");
$sql->addValue(":fechaAlta");
$sql->addSelect("cuota");
$sql->addValue(":cuota");
}
示例3: _crearLoad
private function _crearLoad()
{
$bd = new MySQL();
$sql = new Sql();
$base = $bd->getBase();
$tb = $bd->getTabla();
$tabla = $base . ".{$tb}";
$sql->addTable($tabla);
$sql->addSelect("*");
$sql->addWhere("codigo = :codigo");
return $sql;
}
示例4: _crearGuardar
private function _crearGuardar()
{
$bd = new MySQL();
$sql = new Sql();
$base = $bd->getBase();
$tb = $bd->getTabla();
$tabla = $base . ".{$tb}";
$sql->addTable($tabla);
$sql->setFuncion("insert");
$sql->addSelect("usuario");
$sql->addValue(":usuario");
$sql->addSelect("clave");
$sql->addValue(":clave");
$sql->addSelect("nombre");
$sql->addValue(":nombre");
$sql->addSelect("apellidos");
$sql->addValue(":apellidos");
$sql->addSelect("email");
$sql->addValue(":email");
return $sql;
}
示例5: _crearLoad
private function _crearLoad()
{
$bd = new MySQL();
$sql = new Sql();
$base = $bd->getBase();
$tb = $bd->getTabla();
$tabla = $base . ".{$tb}";
$sql->addTable($tabla);
$sql->addSelect("*");
$curso = $_POST['curso'];
if (isset($_POST['nota'])) {
$nota = $_POST['nota'];
} else {
$nota = "";
}
if (!empty($this->_asignatura)) {
$sql->addWhere("asignatura = :asignatura");
}
if ($curso != 'Todos') {
$sql->addWhere("curso = :curso");
}
if ($nota == 'suspensos') {
$sql->addWhere("nota < 5");
} elseif ($nota == 'aprobados') {
$sql->addWhere("nota >= 5");
}
return $sql;
}