Ver Mensaje Individual
  #5 (permalink)  
Antiguo 09/12/2012, 09:51
ofertasdiarias
 
Fecha de Ingreso: marzo-2011
Mensajes: 115
Antigüedad: 13 años, 1 mes
Puntos: 0
Respuesta: Contador de visitas para post

[HIGHLIGHT="PHP"]
Código PHP:
Ver original
  1. <?php require('/Connections/hoysale.php'); ?>
  2. <?php $updateSQL = ("UPDATE formulario_clasificados SET visitas=visitas+1 WHERE id_rubro=%s");?>
  3. <?php
  4. if (!function_exists("GetSQLValueString")) {
  5. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  6. {
  7.   if (PHP_VERSION < 6) {
  8.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  9.   }
  10.  
  11.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  12.  
  13.   switch ($theType) {
  14.     case "text":
  15.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  16.       break;    
  17.     case "long":
  18.     case "int":
  19.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  20.       break;
  21.     case "double":
  22.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  23.       break;
  24.     case "date":
  25.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  26.       break;
  27.     case "defined":
  28.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  29.       break;
  30.   }
  31.   return $theValue;
  32. }
  33. }
  34.  
  35. $colname_detallesdelclasificado = "-1";
  36. if (isset($_GET['ver'])) {
  37.   $colname_detallesdelclasificado = $_GET['ver'];
  38. }
  39. mysql_select_db($database_hoysale, $hoysale);
  40. $query_detallesdelclasificado = sprintf("SELECT * FROM formulario_clasificados WHERE id_rubro = %s", GetSQLValueString($colname_detallesdelclasificado, "int"));
  41. $detallesdelclasificado = mysql_query($query_detallesdelclasificado, $hoysale) or die(mysql_error());
  42. $row_detallesdelclasificado = mysql_fetch_assoc($detallesdelclasificado);
  43. $totalRows_detallesdelclasificado = mysql_num_rows($detallesdelclasificado);
  44. ?>
  45.  
  46.  
  47. <?php
  48. mysql_free_result($detallesdelclasificado);
  49. ?>

la parte html la pongo en otro comentario porque no me deja agregar mas