Not Found
The requested URL /ejpractico/proceso2.php was not found on this server.
este es mi codigo
index.php
Código PHP:
<?php
include "config.php";
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="estilo.css"/>
<link rel="stylesheet" href="style2.css" type="text/css" />
</head>
<title> EJEMPLO DE COMENTARIOS </title>
<body bgcolor="black">
<img src="TEU.jpg" width="800" height="200"/>
<br />
<br />
<?php
echo "";
echo "<div><h2><font color = #f5f5dc> Zona de comentarios </font> </h2></div>";
$select = "SELECT * FROM comentarios ORDER BY id DESC LIMIT 5";
$query = mysql_query($select,$conex);
$rows = mysql_num_rows($query);
if($rows > 0)
{
echo "<ul class=menu>";
while ($row = mysql_fetch_assoc($query))
{
echo "<li><font color= #006654><font face=cambria><a href=#>" . $row['user'] . " <font size=2>
". $row['fecha'] . "</a></font></font>";
echo "<ul>";
echo "<li><a href=#><textarea class=estiloarea rows=4 cols=60 disabled=true>" . nl2br($row['comentario']) . "</textarea></a><form method=post action=proceso2.php><button type=submit class=stbut1 name=eliminar value=" .$row['id']. "> eliminar </button></form></li>";
echo "</ul>";
echo "</li>";
}
echo"</ul>";
}else{
echo " ";
}
?>
<br /><br /><br />
<div>
<form method="POST" action="proceso.php">
<font color="white">Usuario:</font> <input type="text" class="redondear" placeholder="Nombre" name="user" /> <br /> <br />
<font color="white"> Comentario:</font> <br />
<textarea class="estiloarea1" rows="11" cols="50" placeholder="Inserte su comentario" name="comentario"></textarea><br />
<br />
<button type="submit" class="stbut1" name="Enviar"> Enviar Comentario</button>
</form>
</div>
</body>
</html>
Código PHP:
<?php
$conex = mysql_connect("localhost","Bryan","escorpio01");
$db = mysql_select_db("ejemploc",$conex);
?>
Código PHP:
<?php
include "config.php";
if(isset($_POST['Enviar']))
{
$user = $_POST['user'];
$hora = time();
$fecha= date("H:i, l j F Y",$hora);
$comentario = $_POST['comentario'];
$insert = "INSERT INTO comentarios (user,fecha,comentario)";
$insert.= "VALUES ('" . $user . "','" . $fecha . "','" . $comentario . "')";
mysql_query($insert,$conex);
header("location: index.php");
}else{
echo "Error!";
}
?>
Código PHP:
<?php
include("config.php");
mysql_select_db($db,$conex) or die("problemas al conectar con la bd");
error_reporting(0);
$var = $_POST['eliminar'];
$registro= mysql_query("SELECT id FROM comentarios WHERE id = '$var'",$conex) or die("problemas al realizar la consultar:".mysql_error());
if($reg=mysql_fetch_array($registro))
{
mysql_query("DELETE FROM comentarios WHERE id= '$var'",$conex) or die("problemas al realizar la consultar:".mysql_error());
}
header("location: index.php");
?>