function fncDesignComboMultiple($query, $name, $function, $prefix, $suffix, $selected, $error) { include 'app_db_config.php'; require_once 'dbops.php'; $MyOps = new DBOps($usr_name, $usr_pwd, $target_db, $target_host); $count = 0; $combo = "<select multiple id ='" . $name . "' name ='" . $name . "' " . $function . " class='select2' style='width:275px;'>"; $combo .= $prefix; $res = $MyOps->list_orders($query); if ($res) { while ($row = mysql_fetch_assoc($res)) { $count++; if ($selected == $row['id']) { $combo .= "<option value='" . $row['id'] . "' selected>" . $row["name"] . " *</option>"; } else { $combo .= "<option value='" . $row['id'] . "'>" . $row["name"] . "</option>"; } } } $combo .= $suffix . "</select>"; if ($count == 0) { $alert = "<SCRIPT LANGUAGE=\"JavaScript\">Alertify.dialog.labels.ok ='Aceptar';Alertify.dialog.alert('<img src=\\'general_repository/image/stop_48x48.png\\'><b><big>Error en " . $error . "</big></b>');</SCRIPT>"; $combo .= $alert . " <img src='general_repository/image/stop_24x24.png'> <font color =red><b>Error en el Selector</b></font>"; } return $combo; }
<?php include "app_page.php"; include 'general_repository/php/app_db_config.php'; require_once 'general_repository/php/dbops.php'; $MyOps = new DBOps($usr_name, $usr_pwd, $target_db, $target_host); $query = "SELECT carnet FROM estudiante order by 1 desc limit 1 ;"; $res = $MyOps->list_orders($query); if ($res) { while ($row = mysql_fetch_assoc($res)) { $ultimo_carne = $row["carnet"]; } } $query = " INSERT INTO estudiante ( Nombres, Apellidos, Sexo, FechaNacimiento) \n\t\t\tVALUES ('" . $_POST["nombre"] . "', '" . $_POST["apellido"] . "', '" . $_POST["sexo"] . "', '" . $_POST["fecha"] . "');"; if ($MyOps->insert_to_db($query)) { echo "Se Creo"; }