Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/07/2010, 19:58
Avatar de ronnyra
ronnyra
 
Fecha de Ingreso: diciembre-2009
Mensajes: 173
Antigüedad: 14 años, 5 meses
Puntos: 1
error con un insert en php

hola amigos estoy tratando de insertar un registro en dos tablas distintas de esta manera...

Código Javascript:
Ver original
  1. <?php
  2. include_once "conexion/connect.php";
  3.  
  4. //verificar Datos
  5. if(!is_numeric($_POST["telefono"])){
  6. echo "<script type='text/javascript'>alert('porfavor digite un numero en el campo del telefono'); location.href='./InscripcionEquipos.php'; </script>";
  7. }
  8.  
  9. $pk1 = mysql_query("INSERT INTO inscrip_equipos (Nom_Delegado,Nom_Equipo,Cod_Programa,Cod_Grupo_Dep,Ano,Tel,sexo) VALUES ('". $_POST["name_delegado"] ."','". $_POST["equipo_new"] ."',". $_POST["programas"] .",". $_POST["d_deport"] .",". $_POST["txtfechasolicita"] .",". $_POST["telefono"] .",'". $_POST["sexo"] ."')");
  10.  
  11. $id = mysql_insert_id($pk1);
  12.  
  13. mysql_query("INSERT INTO Detalle_Inscrip_Equi (Cod_Inscrip_Equi) VALUES ($id)");
  14.  
  15.    
  16.                     if(mysql_error()==""){
  17.                                         echo "<script type='text/javascript'>alert('Usted se ha Registrado Satisfactoriamente!!');location.href='InscripcionEquipos.php?texto=2';</script>";
  18.                                    
  19.                                    
  20.                                         }else{
  21.                                           echo "<script type='text/javascript'>alert('Error, Verifique La Información!');  location.href='InscripcionEquipos.php';</script>";                  
  22.  
  23.                                         }  
  24.     mysql_close();
  25. ?>

pero me esta tirando error en

Código PHP:
$id mysql_insert_id($pk1); 
por favor aayudenmeee eh publicado foros y casi nunca me contestan....