Ver Mensaje Individual
  #8 (permalink)  
Antiguo 28/10/2008, 20:23
disweb
 
Fecha de Ingreso: octubre-2008
Mensajes: 165
Antigüedad: 15 años, 6 meses
Puntos: 12
Respuesta: Contador para fotos vistas

Coloqué correctamente el nombre de las variables y ya no me salieron errores, pero no pasa nada en el contador, no aumenta. lo dejé así:
Código:
<?php require_once('Connections/Carrito1.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_detalle = "-1";
if (isset($_GET['foto_id'])) {
  $colname_detalle = $_GET['foto_id'];
}
mysql_select_db($database_Carrito1, $Carrito1);
$query_detalle = sprintf("SELECT * FROM fotos_mias WHERE foto_id = %s", GetSQLValueString($colname_detalle, "int"));
$detalle = mysql_query($query_detalle, $Carrito1) or die(mysql_error());
$row_detalle = mysql_fetch_assoc($detalle);
$totalRows_detalle = mysql_num_rows($detalle);
$sql ="UPDATE `fotos_mias` SET `hits`=`hits`+1 WHERE `foto_id` = %s";
?>
Lo que he puesto en rojo fué lo que le agregué.