Created
December 23, 2013 05:36
-
-
Save 64lines/8092150 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
date_default_timezone_set('America/Lima'); | |
function atras(){ | |
echo "<script>history.back()</script>"; | |
} | |
function abrirBD($nombredb){ | |
$rutadb = $_SERVER['DOCUMENT_ROOT']."/pitaya/db/$nombredb"; | |
$db = sqlite_open($rutadb) or die("No puedo abrir la base de datos "); | |
return $db; | |
} | |
function insertarEntrada($db, $texto){ | |
$fecha = date('j F Y g:i a'); | |
echo $fecha; | |
$actualizacion = sqlite_exec($db, "insert into blog values((select max(id) from blog)+1, '$fecha', '$texto')"); | |
} | |
function select($db, $consulta){ | |
$consultar=sqlite_query($db, $consulta); | |
return $consultar; | |
} | |
function traerEntradas($db){ | |
$separador = '..........................................'; | |
$consulta = 'SELECT ID, FECHA, CONTENIDO FROM BLOG ORDER BY ID DESC'; | |
$resultados = sqlite_array_query($db, $consulta, SQLITE_ASSOC); | |
foreach($resultados as $resultado) { | |
echo '<b>Fecha: ' . $resultado['FECHA'] . '</b><br/>'. $resultado['CONTENIDO'].'<br/>'.$separador.'<br/>'; | |
} | |
} | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment