Ver Mensaje Individual
  #7 (permalink)  
Antiguo 20/09/2005, 21:07
Avatar de helthon
helthon
 
Fecha de Ingreso: junio-2005
Ubicación: Lima
Mensajes: 549
Antigüedad: 18 años, 10 meses
Puntos: 7
$fecha = 'now()' | DATE_FORMAT(CURDATE(), '%d/%m/%Y');

Estoy tratando de guardar la Fecha con las opciones que me indican pero me sale todo tipo de error y no logro el saber porque probe todos sus ejemeplos

Código:
$insert = "Insert into prueba (fecha) values (current_date())"; 

//mi variable fecha     
$fecha = "DATE_FORMAT(CURDATE(), '%d/%m/%Y')"; 

//inserto mis campos 
$insert = "Insert into prueba (fecha) values ($fecha)";
Código PHP:
<?php
require_once('../confdatab/conexionbd.php');
//read inputs field
    
$categoria $_POST['categoria'];
    
$titulo $_POST['titulo'];
    
$detalle $_POST['descripcion'];
    
$contenido $_POST['contenidoweb'];
    
//$imagen = 'NOT';
    
$fuente =  $_POST['fuente'];
    
//$fecha = DATE_FORMAT(CURDATE(), '%d/%m/%Y'); 
    //$fecha = 'now()';
    
    //insert new record
    
$insert 'Insert into publicaciones (categoria, titulo, descripcion, contenido, imagen, fuente, fecha) values 
    ("'
.$categoria.'", "'.$titulo.'", "'.$detalle.'", "'.$contenido.'", "'.$imagen.'", "'.$fuente.'", now()")';
    
$resultIn mysql_query($insert$dbh);
    
$id mysql_insert_id(); 
    
    
$rs mysql_query($dbh$con) or die("Error al grabar el registro: ".mysql_error());
Me sale este error :
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/secre/public_html/admin/editorguardar.php on line 19
Error al grabar el registro: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '")' at line 2

Pero si borro toda la opcion de la fecha no em graba nada
__________________
HELTHON FUENTES
FLORERIA FLORES PERU Floresperu.com.pe
Garantizamos que cada entrega de flores será de la más alta calidad y frescura