Ver Mensaje Individual
  #5 (permalink)  
Antiguo 26/05/2008, 11:38
Avatar de nicolyto77
nicolyto77
 
Fecha de Ingreso: marzo-2007
Ubicación: Buenos Aires
Mensajes: 782
Antigüedad: 17 años, 1 mes
Puntos: 12
Exclamación Respuesta: Ayuda Sistema de Puntuacion Por Favor

Holas

Les agradezco mucho de todas maneras, pero el ultimo codigo no me funciono

Este es el Codigo que Dreamweaver hace para actualizar el registro, funciona perfecto, lo unico que yo quiero que no se actualice de esa forma... sino que se sumen.

Código PHP:
<?php
$currentPage 
$_SERVER["PHP_SELF"];

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"] == "form1")) {
  
$updateSQL sprintf("UPDATE post SET puntuacion=%s WHERE id=%s",
                       
GetSQLValueString($_POST['puntuacion'], "int"),
                       
GetSQLValueString($_POST['id'], "int"));

  
mysql_select_db($database_FS$FS);
  
$Result1 mysql_query($updateSQL$FS) or die(mysql_error());

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

$maxRows_rsUserFull 1;
$pageNum_rsUserFull 0;
if (isset(
$_GET['pageNum_rsUserFull'])) {
  
$pageNum_rsUserFull $_GET['pageNum_rsUserFull'];
}
$startRow_rsUserFull $pageNum_rsUserFull $maxRows_rsUserFull;

mysql_select_db($database_FS$FS);
$query_rsUserFull "SELECT * FROM registro";
$query_limit_rsUserFull sprintf("%s LIMIT %d, %d"$query_rsUserFull$startRow_rsUserFull$maxRows_rsUserFull);
$rsUserFull mysql_query($query_limit_rsUserFull$FS) or die(mysql_error());
$row_rsUserFull mysql_fetch_assoc($rsUserFull);

if (isset(
$_GET['totalRows_rsUserFull'])) {
  
$totalRows_rsUserFull $_GET['totalRows_rsUserFull'];
} else {
  
$all_rsUserFull mysql_query($query_rsUserFull);
  
$totalRows_rsUserFull mysql_num_rows($all_rsUserFull);
}
$totalPages_rsUserFull ceil($totalRows_rsUserFull/$maxRows_rsUserFull)-1;

$colname_rsUser "-1";
if (isset(
$_SESSION['MM_Username'])) {
  
$colname_rsUser = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_FS$FS);
$query_rsUser sprintf("SELECT * FROM registro WHERE username = '%s'"$colname_rsUser);
$rsUser mysql_query($query_rsUser$FS) or die(mysql_error());
$row_rsUser mysql_fetch_assoc($rsUser);
$totalRows_rsUser mysql_num_rows($rsUser);

$maxRows_rsPost 15;
$pageNum_rsPost 0;
if (isset(
$_GET['pageNum_rsPost'])) {
  
$pageNum_rsPost $_GET['pageNum_rsPost'];
}
$startRow_rsPost $pageNum_rsPost $maxRows_rsPost;

mysql_select_db($database_FS$FS);
$query_rsPost "SELECT * FROM post";
$query_limit_rsPost sprintf("%s LIMIT %d, %d"$query_rsPost$startRow_rsPost$maxRows_rsPost);
$rsPost mysql_query($query_limit_rsPost$FS) or die(mysql_error());
$row_rsPost mysql_fetch_assoc($rsPost);

if (isset(
$_GET['totalRows_rsPost'])) {
  
$totalRows_rsPost $_GET['totalRows_rsPost'];
} else {
  
$all_rsPost mysql_query($query_rsPost);
  
$totalRows_rsPost mysql_num_rows($all_rsPost);
}
$totalPages_rsPost ceil($totalRows_rsPost/$maxRows_rsPost)-1;

$queryString_rsPost "";
if (!empty(
$_SERVER['QUERY_STRING'])) {
  
$params explode("&"$_SERVER['QUERY_STRING']);
  
$newParams = array();
  foreach (
$params as $param) {
    if (
stristr($param"pageNum_rsPost") == false && 
        
stristr($param"totalRows_rsPost") == false) {
      
array_push($newParams$param);
    }
  }
  if (
count($newParams) != 0) {
    
$queryString_rsPost "&" htmlentities(implode("&"$newParams));
  }
}
$queryString_rsPost sprintf("&totalRows_rsPost=%d%s"$totalRows_rsPost$queryString_rsPost);
?>
Con ese formulario, cuando selecciono el 2 Por ejemplo, pulso el voton y el valor pasa a ser 2.. Pero si lo vuelvo a pulsar marcando el 3, me actualiza el campo a 3! y yo lo que necesito es que me sume el 2 que ya tenia, mas el 3... el nuevo

Espero su valiosa ayuda.

Gracias de antemano y Saludos
__________________
CabaSoft Networks