Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/12/2010, 16:04
coco925
 
Fecha de Ingreso: febrero-2008
Mensajes: 30
Antigüedad: 16 años, 2 meses
Puntos: 0
Select, Ingreso y Modificacion con PHP

necesito una ayuda con mysql y php:
en este caso tengo que seleccionar, modificar e insertar datos en distintas tablas

Código PHP:
<?php

$Nombres 
$_POST["Nombres"] ;
$Apellidos $_POST['Apellidos'];
$Telefono $_POST['Telefono'];
$Mail $_POST['Mail'];
$Celular $_POST['Celular'];
$Origen $_POST['subject'];
$Programa $_POST['Magisteres'];

$link=mysql_connect(“localhost”,”vtiger”,”CJ_3{je”);
mysql_select_db(“vtigercrm”,$link);

$id "SELECT id+1 FROM vtiger_crmentity_seq"

$contact_no "SELECT left(contact_no, 4, 2) from vtiger_contactdetails where contactid = $id-1"
$ncontacto 'CON'.$conctac_no

$sql 
"UPDATE vtiger_crmentity_seq SET id=%id WHERE id=%id";

$sql2="insert into vtiger_contactsdetails (firstname,lastname,email,phone,mobile,contactid,contact_no)
values ('$Nombres','$Apellido','$Mail','$Telefono','$Celular','$id','$ncontacto')

insert into vtiger_contactscf (contactid,cf_626,cf_627,cf_628,cf_638,cf_649)
values ('$id','1. Primer Interés.','1.1 Primer Interés.','Masculino',SYSDATE(),'$Programa')

$resultado=mysql_query($sql);
mysql_close($link);

php?>
necesito obtener el último valor (+1) de una tabla secuencia e insertarla en distintas tablas y luego ingresar datos que vienen desde un formulario