Foros del Web » Programando para Internet » PHP »

Update con mm_username

Estas en el tema de Update con mm_username en el foro de PHP en Foros del Web. Estoy haciendo esta actualizacion con dreamweaver, el caso es que necesito actualizar los datos del usuario que se ha logueado, por ello necesito capturar el ...
  #1 (permalink)  
Antiguo 29/07/2012, 07:56
 
Fecha de Ingreso: julio-2012
Mensajes: 51
Antigüedad: 11 años, 9 meses
Puntos: 0
Update con mm_username

Estoy haciendo esta actualizacion con dreamweaver, el caso es que necesito actualizar los datos del usuario que se ha logueado, por ello necesito capturar el usuario que se logueo con MM_USERNAME, he realizado el proceso, pero al ejecutar me dice "field list" y siginifca que los campos estan vacios.

Hasta donde se es por que no me ejecutar el SQL update como es. La cuestion es que no he podido cuadrar como insertar el MM_USERNAME en el update ando perdido, gracias si me pueden ayudar aqui esta el codigo

Código PHP:
   <?php require_once('../../../Connections/conex.php'); ?>
   
   <?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$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;
}
}

$colname_Actualizar "-1";
if (isset(
$_GET['MM_Username'])) {
  
$colname_Actualizar $_GET['MM_Username'];
}
mysql_select_db($database_conex$conex);
$query_Actualizar sprintf("SELECT NumIngreso, UltimoIngreso, IngresoHora FROM usuarios WHERE Usuario = %s"GetSQLValueString($colname_Actualizar"text"));
$Actualizar mysql_query($query_Actualizar$conex) or die(mysql_error());
$row_Actualizar mysql_fetch_assoc($Actualizar);
$totalRows_Actualizar mysql_num_rows($Actualizar);

mysql_select_db("$database_conex, $conex");
   
   
$Fechadate('Y-m-d');
   
$Horadate('H:i:s',time() - 3600);
   
$ingresos $row_Actualizar['NumIngreso'];
   
$Numingreso =$ingresos+1;
   
  
  
$sql="UPDATE INTO usuarios (UltimoIngreso,IngresoHora,NumIngreso) VALUES('$Fecha','$Hora','$Numingreso')";
  
   
mysql_query($sql);
   echo 
"
<script> 
alert('ACTUALIZADO SATISFACTORIAMENTE');
location.href='Guia.php'
</script>"

   
   
?>
 
   
   
   
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Insertar datos en MySQL</title>
    <style type="text/css">
    <!--
    body {
        font-family: "Trebuchet MS", Tahoma, Arial;
        font-size: 12px;
        color: #333333;
    }
    h2 {
        font-size: 16px;
        color: #CC0000;
    }
    input, select {
        font-family: "Trebuchet MS", Tahoma, Arial;
        font-size: 11px;
        color: #666666;
    }
    -->
    </style>
    </head>
    <body>
    <h2>&nbsp;</h2>
    </body>
    </html>
    <?php
mysql_free_result
($Actualizar);
?>
  #2 (permalink)  
Antiguo 31/07/2012, 10:11
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: Update con mm_username

ese update esta mal planteado

"UPDATE usuarios set UltimoIngreso='".$Fecha."',IngresoHora='".$Hora."' ,NumIngreso='".$Numingreso."' WHERE Usuario = %s", GetSQLValueString($colname_Actualizar, "text" ";

Etiquetas: html, mysql, sql, update, usuarios
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 17:25.