1 / 6

Archivos

Desarrollo de sistemas Udec. Archivos. Eliseo Melgarejo http://www.udec.cl/~eliseomelgarejo. Daniel Mahn http://www.udec.cl/~dmahn. ¿Cuantos registros tiene mi tabla?. $contar = "SELECT COUNT(*) FROM table "; $count_result = mysql_query($contar, $conexion);

Download Presentation

Archivos

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. Desarrollo de sistemas Udec Archivos Eliseo Melgarejo http://www.udec.cl/~eliseomelgarejo Daniel Mahn http://www.udec.cl/~dmahn

  2. ¿Cuantos registros tiene mi tabla? • $contar = "SELECT COUNT(*) FROM table"; • $count_result = mysql_query($contar, $conexion); • $cantidad = mysql_result($count_result, 0, 0);

  3. Leer archivos desde PHP • $file = fopen("datos.txt","w"); • $var=“hola!”; • fwrite($file,"$var"); • // • while($row=mysql_fetch_row($resultado_sql)) • fwrite($file,"$row[0] "); • fclose ($file); • //escribir los números del 1 al 100 en archivo de texto “w” for write “r” for read

  4. Escribir archivos desde PHP • $file = fopen("datos.txt","w"); • while (!feof($file)) • { • $mascota = fgets ($fp, 4096); • echo $mascota • } • fclose ($file); “w” for write “r” for read

  5. Función explode • $mascota = "1_perro_café”; • list($id,$nombre,$color) = explode("_",$mascota); • echo " id: $id, <br> • nombre: $nombre, <br> • color: $color "; • }

  6. Función implode • <?$array = array('lastname', 'email', 'phone');$imploded = implode(",", $array);echo $imploded; // lastname,email,phone?>

More Related