Ver Mensaje Individual
  #4 (permalink)  
Antiguo 29/07/2009, 14:08
harris00ea
 
Fecha de Ingreso: julio-2009
Ubicación: Bogota
Mensajes: 37
Antigüedad: 14 años, 9 meses
Puntos: 0
Respuesta: Configurar Link Para Editar Resultados de Consulta BD MYSql

Gracias eddwinpaz :

Podrias colaborarme diciendome como puedo invocar ese dato desde mi consulta en el formulario de edicion?

Este es mi codigo y debo estar fallando al llamar esa variable... o bueno eso creo:

Código PHP:
<?php require_once('Connections/FormPrueba.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  
$updateSQL sprintf("UPDATE personal SET Telefono=%s, Nombre=%s, Mail=%s, FECHA=%s WHERE Cedula=%s",
                       
GetSQLValueString($_POST['Telefono'], "text"),
                       
GetSQLValueString($_POST['Nombre'], "text"),
                       
GetSQLValueString($_POST['Mail'], "text"),
                       
GetSQLValueString($_POST['FECHA'], "date"),
                       
GetSQLValueString($_POST['Cedula'], "text"));

  
mysql_select_db($database_FormPrueba$FormPrueba);
  
$Result1 mysql_query($updateSQL$FormPrueba) or die(mysql_error());

  
$updateGoTo "RegIng.html";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$updateGoTo .= (strpos($updateGoTo'?')) ? "&" "?";
    
$updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$updateGoTo));
}

$colname_Editar "-1";
if (isset(
$_GET['<? echo $Cedula ?>'])) {
  
$colname_Editar $_GET['<? echo $Cedula ?>'];
}
mysql_select_db($database_FormPrueba$FormPrueba);
$query_Editar sprintf("SELECT * FROM personal WHERE Cedula = %s"GetSQLValueString($colname_Editar"text"));
$Editar mysql_query($query_Editar$FormPrueba) or die(mysql_error());
$row_Editar mysql_fetch_assoc($Editar);
$totalRows_Editar mysql_num_rows($Editar);
?>
Te Agradezco mucho