-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathloadCategorias.php
More file actions
24 lines (24 loc) · 893 Bytes
/
loadCategorias.php
File metadata and controls
24 lines (24 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
// MODULO LOAD Categorias
// conectar al Servidor de Base de Datos
include "conexion.php";
// crear sentencia SQL para cargar categorias
$sql = "SELECT * FROM categoria ORDER BY nombre";
// ejecutar sentencia SQL
$result = mysql_query($sql,$conex);
// verificar existencia de datos
if (mysql_num_rows($result)==0) {
// mostrar mensaje de error
header("Location: errorPage.php?MSG=Aún no existen categorias");
} else {
// crear lista desplegable (combo box)
while ($regCAT=mysql_fetch_array($result)) {
// convertir caracteres
$nombre = utf8_encode($regCAT["nombre"]);
// crear option del combo
echo "\t\t<option value='$regCAT[idC]'>$nombre</option>\n";
} // end while
// cerrar conexión
mysql_close($conex);
} // endif
?>