I need help with an error, I am inserting data in a table called "posts" but it gives me the news that in certain fields where null is allowed, it says "Undefined index ... in ....... .... "
I do not understand why this error occurs if these fields supposedly accept NULL.
Thank you very much
This shows on the website that I'm doing as an exercise
Aqui van los post
Notice: Undefined index: imagen in C:\xampp\htdocs\CursoVideo2Brain\blogphp\includes\posts.php on line 11
Notice: Undefined index: anio in C:\xampp\htdocs\CursoVideo2Brain\blogphp\includes\posts.php on line 12
Notice: Undefined index: mes in C:\xampp\htdocs\CursoVideo2Brain\blogphp\includes\posts.php on line 12
Notice: Undefined index: dia in C:\xampp\htdocs\CursoVideo2Brain\blogphp\includes\posts.php on line 12
Notice: Undefined index: subtitulo in C:\xampp\htdocs\CursoVideo2Brain\blogphp\includes\posts.php on line 14
Notice: Undefined index: texto in C:\xampp\htdocs\CursoVideo2Brain\blogphp\includes\posts.php on line 15
Here is the code that generates the error:
<?php
$db = new SQLite3('database/blogs.db');
$resultado = $db->query("SELECT * FROM posts WHERE usuario='".$_SESSION['usuariotemporal']."' ORDER BY utc DESC LIMIT 3");
while($fila = $resultado->fetchArray())
{
echo "
<article>
<div id='logov2b' style='background:url(\"photo/".$_SESSION['imagen'].".jpg\");'></div>
<time>".$_SESSION['anio']."-".$_SESSION['mes']."-".$_SESSION['dia']."</time>
<h3>".$_SESSION['titulo']."</h3>
<h4>".$_SESSION['subtitulo']."</h4>
<p>".$_SESSION['texto']."</p>
<br/>";
if($_SESSION['login'] == "yes")
{
echo "<a href='includes/eliminarpost.php?utc=".$fila['utc']."'>Eliminar</a><br/>";
}
if($_SESSION['login'] == "yes")
{
echo "<a href='index.php?titulomod=".$fila['titulo']."&subtitulomod=".$fila['subtitulo']."&textomod=".$fila['texto']."&editando=yes&utc=".$fila['utc']."'>Modificar</a><br/>";
}
echo "</article>";
}
$db->close();
?>