Ver Mensaje Individual
  #11 (permalink)  
Antiguo 07/11/2012, 09:28
ofertasdiarias
 
Fecha de Ingreso: marzo-2011
Mensajes: 115
Antigüedad: 13 años, 2 meses
Puntos: 0
Respuesta: sitio estilo groupon

ahora logre que me diga esta subasta termina en xxxx :

este es el script :
Código PHP:
Ver original
  1. <?php require('/Connections/hoysale.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6.   if (PHP_VERSION < 6) {
  7.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8.   }
  9.  
  10.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12.   switch ($theType) {
  13.     case "text":
  14.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15.       break;    
  16.     case "long":
  17.     case "int":
  18.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19.       break;
  20.     case "double":
  21.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22.       break;
  23.     case "date":
  24.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25.       break;
  26.     case "defined":
  27.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28.       break;
  29.   }
  30.   return $theValue;
  31. }
  32. }
  33.  
  34. $maxRows_ofertas = 3;
  35. $pageNum_ofertas = 0;
  36. if (isset($_GET['pageNum_ofertas'])) {
  37.   $pageNum_ofertas = $_GET['pageNum_ofertas'];
  38. }
  39. $startRow_ofertas = $pageNum_ofertas * $maxRows_ofertas;
  40.  
  41. mysql_select_db($database_hoysale, $hoysale);
  42. $query_ofertas = "SELECT * FROM ofertas";
  43. $query_limit_ofertas = sprintf("%s LIMIT %d, %d", $query_ofertas, $startRow_ofertas, $maxRows_ofertas);
  44. $ofertas = mysql_query($query_limit_ofertas, $hoysale) or die(mysql_error());
  45. $row_ofertas = mysql_fetch_assoc($ofertas);
  46.  
  47. if (isset($_GET['totalRows_ofertas'])) {
  48.   $totalRows_ofertas = $_GET['totalRows_ofertas'];
  49. } else {
  50.   $all_ofertas = mysql_query($query_ofertas);
  51.   $totalRows_ofertas = mysql_num_rows($all_ofertas);
  52. }
  53. $totalPages_ofertas = ceil($totalRows_ofertas/$maxRows_ofertas)-1;
  54.  
  55.  
  56. $target_time = mktime ('08:47:35');
  57.  
  58. $current_time = time();
  59.  
  60. $difference = ($target_time -$current_time);
  61.  
  62. $time = (int) ($difference/$row_ofertas['fecha_de_cierre']);
  63.  
  64. print "esta subasta termina en  '$time' horas";
  65.  
  66.  
  67. ?>
  68.  
  69. <table border="1">
  70.   <tr>
  71.     <td>fecha_de_inicio</td>
  72.     <td>fecha_de_cierre</td>
  73.   </tr>
  74.   <?php do { ?>
  75.     <tr>
  76.       <td><?php echo $row_ofertas['fecha_de_inicio']; ?></td>
  77.       <td><?php echo $row_ofertas['fecha_de_cierre']; ?></td>
  78.     </tr>
  79. </table>
  80.     <?php } while ($row_ofertas = mysql_fetch_assoc($ofertas)); ?>

me salen estos dos errores :
Código PHP:
Ver original
  1. Notice: A non well formed numeric value encountered in C:\xampp\htdocs\Untitled-1.php on line 56
  2. esta subasta termina en '-2880' horas
  3. fecha_de_inicio     fecha_de_cierre
  4. 2012-11-07 08:47:35     10/11/2012 23:59
  5.  
  6. Warning: mysql_fetch_assoc(): 4 is not a valid MySQL result resource in C:\xampp\htdocs\Untitled-1.php on line 81