UNIDAD 5: PHP REGISTROS Y ARCHIVOS SECUENCIALES

TEMA 12: GRAFICOS PHP

Campos de graficos o de imagenes se han convertido en elementos importantes de cualquier base de datos.

Para manejar este elemento:

1.- Es un metodo sencillo, primero subir las imagenes ( de preferencia jpg) con un ftp normal a tusitio y al folder public_html.

2.- Usar el tag <img src> de html EN EL PROGRAMA php

3.- agregar un campo de string llamado fotourl o foto o url a el registro en el archivo secuencial y cargarlo con la direccion internet donde quedo la imagen por ejemplo, por ejemplo http://programacionfacil.com/~tusitio/pato.jpg, MUCHO OJO este paso exije que se tengan que reconstruir todos los programas anteriores para incluir este nuevo campo y volver a crear los archivos de ejemplos, aunque es valido grabar solo el NOMBREFOTO.JPG si el programa y el jpg estan juntos en el mismo directorio.

prog26.php


<HTML>

<FORM ACTION=prog26.php METHOD=post>

DAME CLAVE A BUSCAR:<INPUT TYPE=text NAME=CLAVE><BR>

<INPUT TYPE=submit NAME=OK VALUE="busqueda"><BR>

</FORM></HTML>

<?php

if ($OK == "busqueda") {

// abriendo archivo

$archivo=fopen('alumnos.dat','a+');

// empezando una tabla html para desplegar

echo "<HTML><TABLE Border=10 CellPadding=5><TR>";

echo"<th bgcolor=Green>CLAVE</th><th bgcolor=White>NOMBRE</th><th bgcolor=Red>EDAD</th><th bgcolor=YellowRed>ESTATURA</th></TR>";

// leyendo el archivo

while (!feof($archivo)){

$clave=fgets($archivo);

$nombre=fgets($archivo);

$edad=fgets($archivo);

$estatura=fgets($archivo);

$foto=fgets($archivo);

// convirtiendo al mismo tipo

settype($clave,"integer");

// settype($CLAVE,"integer");

if ( $CLAVE == $clave){

// desplegando en celda de tabla html

echo"<tr>";

echo "<td>".$clave."</td>";

echo "<td>".$nombre."</td>";

echo "<td>".$edad."</td>";

echo "<td>".$estatura."</td>";

echo "<td><img src=".$foto."></td>";

echo"</tr>";};

};

// cerrando archivo y la tabla html

echo "</table>";

fclose($archivo);

};

?>

corrida:

image114.jpg

TAREAS ARCHIVOS LINUX PHP :

CONSTRUIRLE UN CATALOGO DE PRODUCTOS, EMPLEADOS, ETC., A UNA EMPRESA CUALQUIERA QUE TENGA TODOS LOS PROCESOS VISTOS, PUEDEN SELECCIONAR, REFACCIONARIAS, JOYERIAS, VIDEOS, ETC.

 




Google
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
Politica de Privacidad