Ver Mensaje Individual
  #4 (permalink)  
Antiguo 01/06/2010, 07:09
DiegoRivera2010
 
Fecha de Ingreso: abril-2010
Mensajes: 50
Antigüedad: 14 años, 1 mes
Puntos: 0
Respuesta: Ayuda DW y MYSQL

Disculpa juaniquillo tengo una nueva duda es que ahora quiero actualizar ese dato pero cuadno le doy en el boton de actualizar el cual me lleva a esta pagina
Código PHP:
Ver original
  1. <?php require_once('Connections/actualizar.php'); ?>
  2. <?php
  3. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  4. {
  5.   $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
  6.  
  7.   switch ($theType) {
  8.     case "text":
  9.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  10.       break;    
  11.     case "long":
  12.     case "int":
  13.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  14.       break;
  15.     case "double":
  16.       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  17.       break;
  18.     case "date":
  19.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  20.       break;
  21.     case "defined":
  22.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  23.       break;
  24.   }
  25.   return $theValue;
  26. }
  27.  
  28. $editFormAction = $_SERVER['PHP_SELF'];
  29. if (isset($_SERVER['QUERY_STRING'])) {
  30.   $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  31. }
  32.  
  33. if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  34.   $updateSQL = sprintf("UPDATE actualizacion_datos SET nombre=%s, sexo=%s, direccion=%s, barrio=%s, tel_residencia=%s, tel_celular=%s, correo=%s, dia=%s, mes=%s, año=%s, estado_civil=%s, mascota=%s, tipo_mascota=%s, carro=%s, marca_carro=%s, moto=%s, marca_moto=%s, ocupacion=%s, lug_de_trabajo=%s, tel_trabajo=%s, nombre_pareja=%s, dia_pareja=%s, mes_pareja=%s, año_pareja=%s, num_perso_vive=%s, num_hijos=%s, nombre_hijo1=%s, dia_hijo1=%s, mes_hijo1=%s, año_hijo1=%s, nombre_hijo2=%s, dia_hijo2=%s, mes_hijo2=%s, año_hijo2=%s WHERE cedula=%s",
  35.                        GetSQLValueString($_POST['nombre'], "text"),
  36.                        GetSQLValueString($_POST['sexo'], "text"),
  37.                        GetSQLValueString($_POST['direccion'], "text"),
  38.                        GetSQLValueString($_POST['barrio'], "text"),
  39.                        GetSQLValueString($_POST['tel_residencia'], "int"),
  40.                        GetSQLValueString($_POST['tel_celular'], "int"),
  41.                        GetSQLValueString($_POST['correo'], "text"),
  42.                        GetSQLValueString($_POST['dia'], "int"),
  43.                        GetSQLValueString($_POST['mes'], "int"),
  44.                        GetSQLValueString($_POST['ao'], "int"),
  45.                        GetSQLValueString($_POST['estado_civil'], "text"),
  46.                        GetSQLValueString($_POST['mascota'], "text"),
  47.                        GetSQLValueString($_POST['tipo_mascota'], "text"),
  48.                        GetSQLValueString($_POST['carro'], "text"),
  49.                        GetSQLValueString($_POST['marca_carro'], "text"),
  50.                        GetSQLValueString($_POST['moto'], "text"),
  51.                        GetSQLValueString($_POST['marca_moto'], "text"),
  52.                        GetSQLValueString($_POST['ocupacion'], "text"),
  53.                        GetSQLValueString($_POST['lug_de_trabajo'], "text"),
  54.                        GetSQLValueString($_POST['tel_trabajo'], "int"),
  55.                        GetSQLValueString($_POST['nombre_pareja'], "text"),
  56.                        GetSQLValueString($_POST['dia_pareja'], "int"),
  57.                        GetSQLValueString($_POST['mes_pareja'], "int"),
  58.                        GetSQLValueString($_POST['ao_pareja'], "int"),
  59.                        GetSQLValueString($_POST['num_perso_vive'], "int"),
  60.                        GetSQLValueString($_POST['num_hijos'], "int"),
  61.                        GetSQLValueString($_POST['nombre_hijo1'], "text"),
  62.                        GetSQLValueString($_POST['dia_hijo1'], "int"),
  63.                        GetSQLValueString($_POST['mes_hijo1'], "int"),
  64.                        GetSQLValueString($_POST['ao_hijo1'], "int"),
  65.                        GetSQLValueString($_POST['nombre_hijo2'], "text"),
  66.                        GetSQLValueString($_POST['dia_hijo2'], "int"),
  67.                        GetSQLValueString($_POST['mes_hijo2'], "int"),
  68.                        GetSQLValueString($_POST['ao_hijo2'], "int"),
  69.                        GetSQLValueString($_POST['cedula'], "int"));
  70.  
  71.   mysql_select_db($database_actualizar, $actualizar);
  72.   $Result1 = mysql_query($updateSQL, $actualizar) or die(mysql_error());
  73.  
  74.   $updateGoTo = "tarjetapuntos.php";
  75.   if (isset($_SERVER['QUERY_STRING'])) {
  76.     $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
  77.     $updateGoTo .= $_SERVER['QUERY_STRING'];
  78.   }
  79.   header(sprintf("Location: %s", $updateGoTo));
  80. }
  81.  
  82. if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  83.   $updateSQL = sprintf("UPDATE primera SET nombre=%s, sexo=%s, direccion=%s, barrio=%s, tel_residencia=%s, tel_celular=%s, correo=%s, fecha=%s, estado_civil=%s, mascota=%s, tipo_mascota=%s, carro=%s, marca_carro=%s, moto=%s, marca_moto=%s, ocupacion=%s, lug_de_trabajo=%s, tel_trabajo=%s, nombre_pareja=%s, fecha_pareja=%s, num_perso_vive=%s, num_hijos=%s, nombre_hijo1=%s, fecha_hijo1=%s, nombre_hijo2=%s, fecha_hijo2=%s WHERE cedula=%s",
  84.                        GetSQLValueString($_POST['nombre'], "text"),
  85.                        GetSQLValueString($_POST['sexo'], "text"),
  86.                        GetSQLValueString($_POST['direccion'], "text"),
  87.                        GetSQLValueString($_POST['barrio'], "text"),
  88.                        GetSQLValueString($_POST['tel_residencia'], "text"),
  89.                        GetSQLValueString($_POST['tel_celular'], "text"),
  90.                        GetSQLValueString($_POST['correo'], "text"),
  91.                        GetSQLValueString($_POST['fecha'], "date"),
  92.                        GetSQLValueString($_POST['estado_civil'], "text"),
  93.                        GetSQLValueString($_POST['mascota'], "text"),
  94.                        GetSQLValueString($_POST['tipo_mascota'], "text"),
  95.                        GetSQLValueString($_POST['carro'], "text"),
  96.                        GetSQLValueString($_POST['marca_carro'], "text"),
  97.                        GetSQLValueString($_POST['moto'], "text"),
  98.                        GetSQLValueString($_POST['marca_moto'], "text"),
  99.                        GetSQLValueString($_POST['ocupacion'], "text"),
  100.                        GetSQLValueString($_POST['lug_de_trabajo'], "text"),
  101.                        GetSQLValueString($_POST['tel_trabajo'], "int"),
  102.                        GetSQLValueString($_POST['nombre_pareja'], "text"),
  103.                        GetSQLValueString($_POST['fecha_pareja'], "date"),
  104.                        GetSQLValueString($_POST['num_perso_vive'], "int"),
  105.                        GetSQLValueString($_POST['num_hijos'], "int"),
  106.                        GetSQLValueString($_POST['nombre_hijo1'], "text"),
  107.                        GetSQLValueString($_POST['fecha_hijo1'], "date"),
  108.                        GetSQLValueString($_POST['nombre_hijo2'], "text"),
  109.                        GetSQLValueString($_POST['fecha_hijo2'], "date"),
  110.                        GetSQLValueString($_POST['cedula'], "text"));
  111.  
  112.   mysql_select_db($database_actualizar, $actualizar);
  113.   $Result1 = mysql_query($updateSQL, $actualizar) or die(mysql_error());
  114.  
  115.   $updateGoTo = "tarjetapuntos.php";
  116.   if (isset($_SERVER['QUERY_STRING'])) {
  117.     $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
  118.     $updateGoTo .= $_SERVER['QUERY_STRING'];
  119.   }
  120.   header(sprintf("Location: %s", $updateGoTo));
  121. }
  122.  
  123.  
  124. mysql_select_db($database_actualizar, $actualizar);
  125.  
  126. $query_actualizar1 = "SELECT nombre, sexo, cedula, direccion, barrio, tel_residencia, tel_celular, correo, fecha, estado_civil, mascota, tipo_mascota, carro, marca_carro, moto, marca_moto, ocupacion, lug_de_trabajo, tel_trabajo, nombre_pareja, fecha_pareja, num_perso_vive, num_hijos, nombre_hijo1, fecha_hijo1, nombre_hijo2, fecha_hijo2 FROM primera ";
  127.  
  128.  
  129. $actualizar1 = mysql_query($query_actualizar1, $actualizar) or die(mysql_error());
  130. $row_actualizar1 = mysql_fetch_assoc($actualizar1);
  131. $totalRows_actualizar1 = mysql_num_rows($actualizar1);
  132. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  133. <html xmlns="http://www.w3.org/1999/xhtml">
  134. <head>
  135. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  136. <title>Documento sin t&iacute;tulo</title>
  137. <style type="text/css">
  138. <!--
  139. body {
  140.     background-image: url(fondo%201.png);
  141. }
  142. #Layer1 {
  143.     position:absolute;
  144.     width:102px;
  145.     height:27px;
  146.     z-index:1;
  147.     left: 821px;
  148.     top: 23px;
  149. }
  150. #Layer2 {
  151.     position:absolute;
  152.     width:588px;
  153.     height:755px;
  154.     z-index:2;
  155.     top: 18px;
  156.     left: -1px;
  157. }
  158. .Estilo1 {color: #FF9933}
  159. .Estilo2 {color: #FF0000}
  160. -->
  161. </style></head>
  162.  
  163. <body>
  164. <div id="Layer1">
  165.   <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="23">
  166.     <param name="movie" value="atrasdatos.swf" />
  167.     <param name="quality" value="high" />
  168.     <param name="BGCOLOR" value="#C8DE9E" />
  169.     <embed src="atrasdatos.swf" width="100" height="23" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#C8DE9E" ></embed>
  170.   </object>
  171. </div>
  172. <p>&nbsp;</p>
  173. <p>&nbsp;</p>
  174. <p>&nbsp;</p>
  175. <p>&nbsp;</p>
disculpa me toca anexar otro msj y ahi continua el codigo