370 likes | 522 Views
ADICIONAR REGISTROS. AdicionarForm.php. < html > < body > < form method ="post" action ="Adicionar.php"> Cedula : <input type =" Text " name ="cedula">< br > Apellido: <input type =" Text " name ="apellido">< br > Nombre: <input type =" Text " name ="nombre">< br >
E N D
AdicionarForm.php <html> <body> <formmethod="post" action="Adicionar.php"> Cedula : <input type="Text" name="cedula"><br> Apellido: <input type="Text" name="apellido"><br> Nombre: <input type="Text" name="nombre"><br> Fecha_Inscripcion :<input type="Text" name="fecha"><br> Seccion: <input type="Text" name="seccion"><br> Pais_origen:<input type="Text" name="pais"><br> <input type="Submit" name="enviar" value="Aceptar información"> </form> </body> </html>
Adicionar.php <?PHP include 'Conectar.php'; $cedula=$_POST['cedula']; $nombre=$_POST['nombre']; $apellido=$_POST['apellido']; $fecha=$_POST['fecha']; $seccion=$_POST['seccion']; $pais=$_POST['pais']; mysql_connect('localhost',$username,$password); @mysql_select_db($database) or die( "No se puede conectar a la base de DATOS");
$query = "INSERT INTO alumnos VALUES ('$cedula','$nombre','$apellido','$fecha','$seccion','$pais')"; mysql_query($query); mysql_close(); echo "PASO SALIR"; include 'AdicionarForm.php'; ?>
Conectar.php <?php $username="root"; $password=“ ”; $database="iutval"; ?>
Buscar1.php <html> <body> <formmethod = "POST" action = "Buscar2.php"> <strong>Palabra clave:</strong> <input type="text" name="buscar" size="20"><br><br> <input type="submit" value="Buscar"> </form> </body> </html>
Buscar2.php <?php $buscar=$_POST['buscar']; echo "<br>"; echo $buscar; if (isset($buscar)){ $b = $buscar; include 'Conectar.php'; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "No encuentra la Base de Datos"); $sql = "SELECT * FROM alumnos WHERE nombre LIKE '%$b%' or apellido LIKE '%$b%' orpaislike '%$b%'";
$result = mysql_query($sql); if ($row = mysql_fetch_array($result)){ echo "<tableborder = '1'> \n"; //Mostramos los nombres de las tablas mysql_field_seek($result,0); while ($field = mysql_fetch_field($result)){ echo "<td><b>$field->name</b></td> \n"; } echo "</tr> \n"; do { echo "<tr> \n"; echo "<td>".$row["CEDULA"]."</td> \n"; echo "<td>".$row["APELLIDO"]."</td> \n"; echo "<td>".$row["NOMBRE"]."</td> \n"; echo "<td>".$row["FECHA"]."</td> \n";
echo "<td>".$row["SECCION"]."</td> \n"; echo "<td>".$row["PAIS"]."</td> \n"; echo "</tr> \n"; } while ($row = mysql_fetch_array($result)); echo "<p><a href=Buscar1.php>Volver</p> \n"; echo "</table> \n"; } else { echo "<p>¡No se ha encontrado ningún registro!</p>\n"; echo "<p><a href=Buscar1.php>Volver</p> \n"; } } ?>
Delete.php <html> <body> <formmethod = "POST" action = "Delete1.php"> <strong>Palabra clave:</strong> <input type="value" name="buscar" size="11"><br><br> <input type="submit" value="Buscar"> </form> <formmethod = "POST" action = "Delete2.php"> <strong>Palabra clave:</strong> <input type="value" name="buscar" size="11"><br><br> <input type="submit" value="Borrar"> </form> </body> </html>
Delete1.php <?php $buscar=$_POST['buscar']; echo "<br>"; echo $buscar; if (isset($buscar)){ $b = $buscar; include 'Conectar.php'; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "No encuentra la Base de Datos"); $sql = "SELECT * FROM alumnos WHERE cedula =$b"; $result = mysql_query($sql); if ($row = mysql_fetch_array($result)){ echo "<tableborder = '1'> \n"; //Mostramos los nombres de las tablas mysql_field_seek($result,0);
while ($field = mysql_fetch_field($result)){ echo "<td><b>$field->name</b></td> \n"; } echo "</tr> \n"; do { echo "<tr> \n"; echo "<td>".$row["CEDULA"]."</td> \n"; echo "<td>".$row["APELLIDO"]."</td> \n"; echo "<td>".$row["NOMBRE"]."</td> \n"; echo "<td>".$row["FECHA"]."</td> \n"; echo "<td>".$row["SECCION"]."</td> \n"; echo "<td>".$row["PAIS"]."</td> \n"; echo "</tr> \n";
} while ($row = mysql_fetch_array($result)); echo "<p><a href=Delete.php>Volver</p> \n"; echo "</table> \n"; } else { echo "<p>¡No se ha encontrado ningún registro!</p>\n"; echo "<p><a href=Delete.php>Volver</p> \n"; } } ?>
Delete2.php <?php $buscar=$_POST['buscar']; echo "<br>"; echo $buscar; if (isset($buscar)){ $b = $buscar; include 'Conectar.php'; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "No encuentra la Base de Datos"); $sql= "Deletefrom alumnos where CEDULA=$b"; echo "Se borro el registro, $b"; mysql_query($sql); } mysql_close(); ?>
Exam1.php <html> <body> <h1>Seleccion de Alumnos por mes de Ingreso</h1> <formmethod = "POST" action = "Exam2.php"> <strong>Mes desde:</strong> <input type="text" name="D1" size="20"><br><br> <strong>Mes Hasta:</strong> <input type="text" name="D2" size="20"><br><br> <input type="submit" value="Buscar"> </form> </body> </html>
Exam2.php <?php $D1=$_POST['D1']; $D2=$_POST['D2']; echo "<br>"; echo $D1; echo $D2; if (isset($D1)){ $a = $D1; $b = $D2; $username="root"; $password=“"; $database="iutval"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "No encuentra la Base de Datos");
$sql = "select cedula, nombre, Month(fecha) As Mes, year(fecha) as Año from `alumnos` wheremonth(fecha) between $a and $b Orderbyyear(fecha), month(fecha)"; $result = mysql_query($sql); if ($row = mysql_fetch_array($result)){ echo "<tableborder = '1'> \n"; mysql_field_seek($result,0); while ($field = mysql_fetch_field($result)){ echo "<td><b>$field->name</b></td> \n"; } echo "</tr> \n"; do {
echo "<tr> \n"; echo "<td>".$row["cedula"]."</td> \n"; echo "<td>".$row["nombre"]."</td> \n"; echo "<td>".$row["Mes"]."</td> \n"; echo "<td>".$row["Año"]."</td> \n"; echo "</tr> \n"; } while ($row = mysql_fetch_array($result)); echo "<p><a href=Exam1.php>Volver</p> \n"; echo "</table> \n"; } else { echo "<p>¡No se ha encontrado ningún registro!</p>\n"; echo "<p><a href=Exam1.php>Volver</p> \n"; } } ?>
Exam3.php <html> <body> <h1>Busquedas Varias</h1> <formmethod = "POST" action = "Exam4.php" name="Uno"> <strong>Detalle x Cedula:</strong> <input type="text" name="D1" size="20"><br><br> <input type="submit" value="Buscar"> </form> <formmethod = "POST" action = "Exam5.php" name="Uno"> <strong>Promedio por Seccion y Materia:</strong> <input type="text" name="D2" size="20"><br><br> <input type="submit" value="Buscar"> </form> </body> </html>
Exam4.php <?php $D1=$_POST['D1']; echo "<br>"; echo $D1; if (isset($D1)){ $a = $D1; $username="root"; $password=“"; $database="iutval"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "No encuentra la Base de Datos");
$sql = "selectalumnos.`CEDULA`, alumnos.nombre, apellido, materias.`DESCRIPCION` As Materia, nota from `alumnos`, `alumnomateria`, `materias` where `alumnos`.`CEDULA` = `alumnomateria`.`CEDULA` and `alumnomateria`.`MATERIA` = `materias`.`CODIGO` and alumnos.cedula = $D1"; $result = mysql_query($sql); if ($row = mysql_fetch_array($result)){ echo "<tableborder = '1'> \n"; mysql_field_seek($result,0); while ($field = mysql_fetch_field($result)){ echo "<td><b>$field->name</b></td> \n"; }
echo "</tr> \n"; do { echo "<tr> \n"; echo "<td>".$row["CEDULA"]."</td> \n"; echo "<td>".$row["nombre"]."</td> \n"; echo "<td>".$row["apellido"]."</td> \n"; echo "<td>".$row["Materia"]."</td> \n"; echo "<td>".$row["nota"]."</td> \n"; echo "</tr> \n"; } while ($row = mysql_fetch_array($result)); echo "<p><a href=Exam3.php>Volver</p> \n"; echo "</table> \n"; } else { echo "<p>¡No se ha encontrado ningún registro!</p>\n"; echo "<p><a href=Exam3.php>Volver</p> \n"; }} ?>
Exam5.php <?php $D2=$_POST['D2']; echo "<br>"; echo $D2; if (isset($D2)){ $username="root"; $password=“"; $database="iutval"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "No encuentra la Base de Datos"); $sql = "selectalumnos.`SECCION`, materias.`DESCRIPCION` as Materia, avg(nota) as promedio from `alumnos`, `alumnomateria`, `materias`
where `alumnos`.`CEDULA` = `alumnomateria`.`CEDULA` and `alumnomateria`.`MATERIA` = `materias`.`CODIGO` and `materias`.`DESCRIPCION` = '$D2' groupby `alumnos`.`SECCION`"; $result = mysql_query($sql); if ($row = mysql_fetch_array($result)){ echo "<tableborder = '1'> \n"; mysql_field_seek($result,0); while ($field = mysql_fetch_field($result)){ echo "<td><b>$field->name</b></td> \n"; } echo "</tr> \n"; do { echo "<tr> \n"; echo "<td>".$row["SECCION"]."</td> \n"; echo "<td>".$row["Materia"]."</td> \n"; echo "<td>".$row["promedio"]."</td> \n";
echo "</tr> \n"; } while ($row = mysql_fetch_array($result)); echo "<p><a href=Exam3.php>Volver</p> \n"; echo "</table> \n"; } else { echo "<p>¡No se ha encontrado ningún registro!</p>\n"; echo "<p><a href=Exam3.php>Volver</p> \n"; } } ?>
Exam7.php <html> <body> <h1>Promedio de Notas Por Año/Mes</h1> <formmethod = "POST" action = "Exam6.php"> <strong>Mes desde:</strong> <input type="text" name="D1" size="20"><br><br> <strong>Mes Hasta:</strong> <input type="text" name="D2" size="20"><br><br> <input type="submit" value="Buscar"> </form> </body> </html>
Exam6.php <?php $D1=$_POST['D1']; $D2=$_POST['D2']; echo "<br>"; echo $D1; echo $D2; if (isset($D1)){ $a = $D1; $b = $D2; $username="root"; $password=""; $database="iutval"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "No encuentra la Base de Datos");
$sql = "selectyear(fecha) as Año, month(fecha) As Mes, avg(nota) as Promedio from `alumnos`, `alumnomateria`, `materias` where `alumnos`.`CEDULA` = `alumnomateria`.`CEDULA` and `alumnomateria`.`MATERIA` = `materias`.`CODIGO` and month(fecha) between $a and $b groupbyyear(fecha), month(fecha) orderbyyear(fecha), month(fecha)"; $result = mysql_query($sql); if ($row = mysql_fetch_array($result)){ echo "<tableborder = '1'> \n"; mysql_field_seek($result,0); while ($field = mysql_fetch_field($result)){ echo "<td><b>$field->name</b></td> \n"; }
echo "</tr> \n"; do { echo "<tr> \n"; echo "<td>".$row["Año"]."</td> \n"; echo "<td>".$row["Mes"]."</td> \n"; echo "<td>".$row["Promedio"]."</td> \n"; echo "</tr> \n"; } while ($row = mysql_fetch_array($result)); echo "<p><a href=Exam7.php>Volver</p> \n"; echo "</table> \n"; } else { echo "<p>¡No se ha encontrado ningún registro!</p>\n"; echo "<p><a href=Exam7.php>Volver</p> \n"; } } ?>
SELECT WEEK(fpedido) AS Semana,DAYOFWEEK(fpedido) AS Dia,cliente,sum(totalbs) FROM `ventas` groupbyweek(fpedido),DAYOFWEEK(fpedido),cliente with ROLLUP
SELECT * from `new_view2` where dia is NULL