1 / 37

ADICIONAR REGISTROS

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 >

jovita
Download Presentation

ADICIONAR REGISTROS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ADICIONAR REGISTROS

  2. 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>

  3. 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");

  4. $query = "INSERT INTO alumnos VALUES ('$cedula','$nombre','$apellido','$fecha','$seccion','$pais')"; mysql_query($query); mysql_close(); echo "PASO SALIR"; include 'AdicionarForm.php'; ?>

  5. Conectar.php <?php $username="root"; $password=“ ”; $database="iutval"; ?>

  6. BUSCAR REGISTROS

  7. 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>

  8. 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%'";

  9. $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";

  10. 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"; } } ?>

  11. BORRAR REGISTROS

  12. 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>

  13. 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);

  14. 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";

  15. } 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"; } } ?>

  16. 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(); ?>

  17. CONSULTAR REGISTROS

  18. 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>

  19. 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");

  20. $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 {

  21. 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"; } } ?>

  22. 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>

  23. 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");

  24. $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"; }

  25. 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"; }} ?>

  26. 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`

  27. 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";

  28. 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"; } } ?>

  29. 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>

  30. 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");

  31. $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"; }

  32. 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"; } } ?>

  33. SELECT WEEK(fpedido) AS Semana,DAYOFWEEK(fpedido) AS Dia,cliente,sum(totalbs) FROM `ventas` groupbyweek(fpedido),DAYOFWEEK(fpedido),cliente with ROLLUP

  34. SELECT * from `new_view2` where dia is NULL

More Related