Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/12/2008, 17:38
PANAFLAKIN
 
Fecha de Ingreso: septiembre-2004
Ubicación: Chihuahua Mex
Mensajes: 404
Antigüedad: 19 años, 7 meses
Puntos: 2
Problema al Insertar datos en la base de datos

Hola miren tengo una funcion para insertar datos a la base de datos pero al ejecutarla los datos no se insertan en la base de datos y no me muestra ningun error.

Noticias.php
Código PHP:
<?php 
require_once './db/conexion.php';
require_once 
'./funciones/noticias.php';
if (!isset(
$_SESSION['Logeado'])) {
header('Location: index.php');
}
else {
//EnviarNoticias
if (isset($_POST['enviarNoticia'])){
enviarNoticia($titulo$textoInicial$textoCompleto);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Noticias</title>
</head>

<body>
<div align="center">
  <p><strong>Enviar Una Noticia</strong></p>
  <form method="post" action="<?php $_SERVER['PHP_SELF'];?>">
    <table width="100%" border="0" cellspacing="5" cellpadding="0">
      <tr>
        <td valign="top"><div align="right">Titulo: </div></td>
        <td>          <input name="titulo" type="text" id="titulo" value="" size="50" />        </td>
      </tr>
      <tr>
        <td valign="top"><div align="right">Texto Inicial:</div></td>
        <td>
          <textarea name="textoInicial" id="textoInicial" cols="50" rows="5"></textarea>        </td>
      </tr>
      <tr>
        <td valign="top"><div align="right">Texto Completo:</div></td>
        <td>
          <textarea name="textoCompleto" id="textoCompleto" cols="50" rows="5"></textarea>        </td>
      </tr>
    </table>
    <label></label>
    <p>
      <label></label>
      <label>
      <input type="submit" name="enviarNoticia" id="enviarNoticia" value="Enviar" />
      </label>
    </p>
    <p>
      <label></label>
    </p>
  </form>
  <p>&nbsp;</p>
</div>
</body>
</html>
<?php ?>
funciones/noticias.php
Código PHP:
<?php
function enviarNoticia($titulo$textoInicial$TextoCompleto){
//Obtenemos los Datos
   
$titulo trim($_POST['titulo']);
   
$textoInicial $_POST['pass'];
   
$textoCompleto $_POST['textoCompleto'];
   
   
//Aseguramos que no alla inyecciones sql
   
$titulo mysql_real_escape_string($titulo);
   
$textoInicial mysql_real_escape_string($textoInicial);
   
$textoCompleto mysql_real_escape_string($textoCompleto);
   
   
//Insertar los datos en la base de datos
   
$sql "INSERT INTO  'noticias' ('titulo' , 'textoInicial' , 'textoCompleto' , 'fecha' , 'borrado' ) 
VALUES ('$titulo',  '$textoInicial',  '$textoCompleto');" 
or die('Query Fallo. ' mysql_error());
   
// recargar la pagina
     
echo "Noticia Agregada Satisfatoriamente";
     }
     
?>