Foros del Web » Programación para mayores de 30 ;) » Bases de Datos General »

Problemas al hacer un update a mi base sql con dreamweaver

Estas en el tema de Problemas al hacer un update a mi base sql con dreamweaver en el foro de Bases de Datos General en Foros del Web. Hola, estoy tratando de hacer un update con php a mi base de datos (estoy usando dreamweaver) el tema esta q cuando hago el update ...
  #1 (permalink)  
Antiguo 23/10/2008, 08:01
 
Fecha de Ingreso: agosto-2008
Mensajes: 97
Antigüedad: 16 años, 5 meses
Puntos: 1
Problemas al hacer un update a mi base sql con dreamweaver

Hola, estoy tratando de hacer un update con php a mi base de datos (estoy usando dreamweaver) el tema esta q cuando hago el update me borra la info q ya tenia en mi base de dato y la remplaza por Null y tampoco me cambia de registro, o sea yo tengo una pagina inicial con la lista de valores para los usuarios para q ellos los puedan modificar, el tema es q siempre queda en el primer registro.

les dejo el codigo q estoy usando, y mil gracias al q pueda aportar alguna solucion je ya q me estoy volviendo loco con esto .


Código PHP:
<?php require_once('Connections/connAudit.php'); ?>

<?php
function GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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"] == "form2")) {
  
$updateSQL sprintf("UPDATE tbl_planillabase2 SET TrackingID=%s, Ecckt=%s, TelcoID=%s, ICSC=%s, ProvSys=%s, Cost=%s, CktID=%s, CFA=%s, AccionSorter=%s, Comments=%s WHERE id=%s",
                       
GetSQLValueString($_POST['TrackingID'], "text"),
                       
GetSQLValueString($_POST['Ecckt'], "text"),
                       
GetSQLValueString($_POST['TelcoID'], "text"),
                       
GetSQLValueString($_POST['ICSC'], "text"),
                       
GetSQLValueString($_POST['ProvSys'], "text"),
                       
GetSQLValueString($_POST['Cost'], "text"),
                       
GetSQLValueString($_POST['CktID'], "text"),
                       
GetSQLValueString($_POST['CFA'], "text"),
                       
GetSQLValueString($_POST['AccionSorter'], "text"),
                       
GetSQLValueString($_POST['Comments'], "text"),
                       
GetSQLValueString($_POST['id'], "int"));

  
mysql_select_db($database_connAudit$connAudit);
  
$Result1 mysql_query($updateSQL$connAudit) or die(mysql_error());

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

if ((isset(
$_POST["MM_update"])) && ($_POST["MM_update"] == "form2")) {
  
$updateSQL sprintf("UPDATE tbl_planillabase2 SET CFA=%s, AccionSorter=%s, Comments=%s WHERE id=%s",
                       
GetSQLValueString($_POST['CFA'], "text"),
                       
GetSQLValueString($_POST['AccionSorter'], "text"),
                       
GetSQLValueString($_POST['Comments'], "text"),
                       
GetSQLValueString($_POST['id'], "int"));

  
mysql_select_db($database_connAudit$connAudit);
  
$Result1 mysql_query($updateSQL$connAudit) or die(mysql_error());

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

mysql_select_db($database_connAudit$connAudit);
$query_rs_planilla "SELECT id, TrackingID, Ecckt, TelcoID, ICSC, ProvSys, Cost, CktID, CFA, AccionSorter, Comments FROM tbl_planillabase2";
$rs_planilla mysql_query($query_rs_planilla$connAudit) or die(mysql_error());
$row_rs_planilla mysql_fetch_assoc($rs_planilla);
$totalRows_rs_planilla mysql_num_rows($rs_planilla);
?>
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:51.