Ver Mensaje Individual
  #7 (permalink)  
Antiguo 16/01/2012, 08:15
toyeslomao
 
Fecha de Ingreso: diciembre-2010
Ubicación: tenerife
Mensajes: 60
Antigüedad: 13 años, 9 meses
Puntos: 0
Respuesta: error by order fecha desc limit

no hay manera de arreglarlo , cuando no pongo la parte de order by , la pagina
me carga bien, no hay problemas, cuando le pongo ese codigo bag, se chafa todo
vpy a colocar el codigo completo a ver q pasa y una imagen de la base de datos a ver si es por ahi donde viene el fallo,

Código PHP:
Ver original
  1. <?php require_once('../Connections/prueba.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. mysql_select_db($database_prueba, $prueba);
  35. $query_foros = "SELECT * FROM categorias";
  36. $foros = mysql_query($query_foros, $prueba) or die(mysql_error());
  37. $row_foros = mysql_fetch_assoc($foros);
  38. $totalRows_foros = mysql_num_rows($foros);
  39. ?>
  40.  
  41.  
  42. <?php do { ?>
  43.   <?php
  44.  mysql_select_db($database_prueba, $prueba);
  45.   $publicacion_sql = "SELECT id_mensaje FROM mensajes WHERE categoria = " .
  46.  $row_foros['id_categorias'];
  47.   $ultimo_sql = "SELECT autor , fecha FROM mensaje WHERE categoria = "  .
  48.   $row_foros['id_categorias'] . "ORDER BY fecha DESC LIMIT 1";
  49.   $upPost = mysql_query (date) or die (mysql_error ()) ;
  50.   $pTotales = mysql_query($publicacion_sql) or die (mysql_error ()) ;
  51.   ?>
  52.     <tr>
  53.       <td height="46" class="categoria1">
  54.       <div align="left" class="categoria2"><a href="untitled-8.php?cat=<?php echo $row_foros['id_categorias']; ?>"><font color="#FFFFFF"><?php echo $row_foros['nombre']; ?></font></a><br />
  55.         <span class="categoria4"><?php echo $row_foros['descripcion']; ?></span>
  56.       </div></td>
  57.       <td align="center"><?php echo mysql_num_rows($pTotales) ;?></td>
  58.       <td class="categoria2">
  59.       <?php
  60.       $up = mysql_fetch_assoc ($upost) ;
  61.       echo $up ['fecha'] ;
  62.       echo '</br>' ;
  63.       echo $up ['autor'] ;
  64.       ?>
  65.       </td>
  66.     </tr>
  67.     <?php } while ($row_foros = mysql_fetch_assoc($foros)); ?>
  68. </table>
  69. <p>&nbsp;</p>
  70. <p>&nbsp;</p>
  71. </body>
  72. </html>
  73. <?php
  74. ?>


http://imageshack.us/photo/my-images/502/dibujoxim.jpg/