Ver Mensaje Individual
  #3 (permalink)  
Antiguo 21/03/2004, 19:11
karpoj23
 
Fecha de Ingreso: diciembre-2003
Ubicación: Málaga
Mensajes: 495
Antigüedad: 20 años, 5 meses
Puntos: 0
no me va

esta es la sentencia en la k añado el nuevo campo en la base de datos:

$sql="INSERT INTO foro (usuario,fecha,comentario,tema) VALUES ('$_SESSION[usuario]','$_SESSION[fe]','$_POST[comentario]','$_POST[tema]')";

y ahora kiero q ese campo autonumerico id se añada en otra tabla.

tengo puesto lo ke me dijistes:

$ultimo_id=mysql_insert_id();

$sql="INSERT INTO respuesta (usuario,fecha,comentario,tema,id) VALUES ('$_SESSION[usuario]','$_SESSION[fe]','$_POST[comentario]','$_POST[tema]',$ultimo)";

pero me da el siguiente error:

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 1