本文整理汇总了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;
}