Ver Mensaje Individual
  #5 (permalink)  
Antiguo 06/08/2011, 03:15
Avatar de zulkas
zulkas
 
Fecha de Ingreso: julio-2011
Mensajes: 126
Antigüedad: 13 años, 4 meses
Puntos: 11
Respuesta: Conflicto con base de datos

Cita:
Iniciado por kenproxd Ver Mensaje
Gracias por responder,

hice lo que me dijiste, quedandome el código asi:

Código PHP:
Ver original
  1. <div class="popular">
  2. <div class="module">                
  3. <h3>EVENTOS</h3>        
  4. <ul class="mostread">
  5. <?php
  6. $ipeve = '******';
  7. $usuarioeve = '******';
  8. $passwordeve = '******';
  9. $db_nameeve = '******';
  10. $conneve = mysql_connect($ipeve,$usuarioeve,$passwordeve) or die();
  11. mysql_select_db($db_nameeve,$conneve) or die();
  12. $sqleve = "select  * from eventos ORDER BY mes DESC, dia DESC LIMIT 0, 5";
  13.  
  14. $reseve = mysql_query($sqleve,$conneve) or die(mysql_error());
  15. while($roweve = mysql_fetch_array($reseve)){
  16.  echo '    <li class=mostread>
  17.        <a href='.$roweve['link'].' target=blank class=mostread>
  18.            '.$roweve['nombre'].'</a>
  19.    </li>';
  20.  }
  21. mysql_close($conneve);
  22.  ?></ul></div>
  23.                     </div>
  24.                     <div class="latest">
  25. <div class="module">                
  26. <h3>ÚLTIMOS POSTS</h3>        
  27. <ul class="mostread">
  28. <?php
  29. $ipposts = '******';
  30. $usuarioposts = '******';
  31. $passwordposts = '******';
  32. $db_nameposts = '******';
  33. $connposts = mysql_connect($ipposts,$usuarioposts,$passwordposts) or die();
  34. mysql_select_db($db_nameposts,$connposts) or die();
  35. $sqlposts = "SELECT * FROM phpbb_topics WHERE forum_id NOT IN (15, 16, 19) ORDER BY topic_last_post_time DESC LIMIT 0,5";
  36.  
  37. $resposts = mysql_query($sqlposts,$connposts) or die(mysql_error());
  38. while($row = mysql_fetch_array($resposts)){
  39.     if (strlen($row['topic_title']) > 35) {
  40.         $row['topic_title'] = substr($row['topic_title'],0,35-3)."...";  
  41.     }
  42.     echo '
  43. <li class=mostread><A HREF="http://foro.auditiontown.net/viewtopic.php?f='.$row['forum_id'].'&t='.$row['topic_id'].'" target=_blank>'.$row['topic_title'].'</font></A></li>';
  44. }
  45. mysql_free_result($resposts);
  46. mysql_close($connposts);
  47.  ?></ul></div>
  48.                     </div>

lo que me da el siguiente error:

* Error al cargar los módulos:Table 'audition_town.jos_modules' doesn't exist SQL=SELECT id, title, module, position, content, showtitle, control, params FROM jos_modules AS m LEFT JOIN jos_modules_menu AS mm ON mm.moduleid = m.id WHERE m.published = 1 AND m.access <= 0 AND m.client_id = 0 AND ( mm.menuid = 1 OR mm.menuid = 0 ) ORDER BY position, ordering
* Error al cargar los módulos:Table 'audition_town.jos_modules' doesn't exist SQL=SELECT id, title, module, position, content, showtitle, control, params FROM jos_modules AS m LEFT JOIN jos_modules_menu AS mm ON mm.moduleid = m.id WHERE m.published = 1 AND m.access <= 0 AND m.client_id = 0 AND ( mm.menuid = 1 OR mm.menuid = 0 ) ORDER BY position, ordering
* Error al cargar los módulos:Table 'audition_town.jos_modules' doesn't exist SQL=SELECT id, title, module, position, content, showtitle, control, params FROM jos_modules AS m LEFT JOIN jos_modules_menu AS mm ON mm.moduleid = m.id WHERE m.published = 1 AND m.access <= 0 AND m.client_id = 0 AND ( mm.menuid = 1 OR mm.menuid = 0 ) ORDER BY position, ordering
* Error al cargar los módulos:Table 'audition_town.jos_modules' doesn't exist SQL=SELECT id, title, module, position, content, showtitle, control, params FROM jos_modules AS m LEFT JOIN jos_modules_menu AS mm ON mm.moduleid = m.id WHERE m.published = 1 AND m.access <= 0 AND m.client_id = 0 AND ( mm.menuid = 1 OR mm.menuid = 0 ) ORDER BY position, ordering
* Error al cargar los módulos:Table 'audition_town.jos_modules' doesn't exist SQL=SELECT id, title, module, position, content, showtitle, control, params FROM jos_modules AS m LEFT JOIN jos_modules_menu AS mm ON mm.moduleid = m.id WHERE m.published = 1 AND m.access <= 0 AND m.client_id = 0 AND ( mm.menuid = 1 OR mm.menuid = 0 ) ORDER BY position, ordering
* Error al cargar los módulos:Table 'audition_town.jos_modules' doesn't exist SQL=SELECT id, title, module, position, content, showtitle, control, params FROM jos_modules AS m LEFT JOIN jos_modules_menu AS mm ON mm.moduleid = m.id WHERE m.published = 1 AND m.access <= 0 AND m.client_id = 0 AND ( mm.menuid = 1 OR mm.menuid = 0 ) ORDER BY position, ordering
* Error al cargar los módulos:Table 'audition_town.jos_modules' doesn't exist SQL=SELECT id, title, module, position, content, showtitle, control, params FROM jos_modules AS m LEFT JOIN jos_modules_menu AS mm ON mm.moduleid = m.id WHERE m.published = 1 AND m.access <= 0 AND m.client_id = 0 AND ( mm.menuid = 1 OR mm.menuid = 0 ) ORDER BY position, ordering
* Error al cargar los módulos:Table 'audition_town.jos_modules' doesn't exist SQL=SELECT id, title, module, position, content, showtitle, control, params FROM jos_modules AS m LEFT JOIN jos_modules_menu AS mm ON mm.moduleid = m.id WHERE m.published = 1 AND m.access <= 0 AND m.client_id = 0 AND ( mm.menuid = 1 OR mm.menuid = 0 ) ORDER BY position, ordering
* Error al cargar los módulos:Table 'audition_town.jos_modules' doesn't exist SQL=SELECT id, title, module, position, content, showtitle, control, params FROM jos_modules AS m LEFT JOIN jos_modules_menu AS mm ON mm.moduleid = m.id WHERE m.published = 1 AND m.access <= 0 AND m.client_id = 0 AND ( mm.menuid = 1 OR mm.menuid = 0 ) ORDER BY position, ordering
* Error al cargar los módulos:Table 'audition_town.jos_modules' doesn't exist SQL=SELECT id, title, module, position, content, showtitle, control, params FROM jos_modules AS m LEFT JOIN jos_modules_menu AS mm ON mm.moduleid = m.id WHERE m.published = 1 AND m.access <= 0 AND m.client_id = 0 AND ( mm.menuid = 1 OR mm.menuid = 0 ) ORDER BY position, ordering
* Error al cargar los módulos:Table 'audition_town.jos_modules' doesn't exist SQL=SELECT id, title, module, position, content, showtitle, control, params FROM jos_modules AS m LEFT JOIN jos_modules_menu AS mm ON mm.moduleid = m.id WHERE m.published = 1 AND m.access <= 0 AND m.client_id = 0 AND ( mm.menuid = 1 OR mm.menuid = 0 ) ORDER BY position, ordering


De igual manera, los datos que imprimen las consultas de Eventos y Ultimos posts salen perfectamente pero el contenido no se muestra.
O no entiendo bien o más bien eso parece un error de SQL al parecer al abrir tus propias sesiones de mysl genera un error.

¿Las tablas se encuentran en la misma base de datos que Joomla? si es así puedes utilizar esto mejor y más seguro...
Código PHP:
            // Create a new query object.
            
$db JFactory::getDbo();
            
$query $db->getQuery(true);

            
// Construct the query
            
$query->select('campo 1 AS value, campo2 AS text');
            
$query->from('tabla AS s');
            
$query->order('s.name');

            
// Setup the query
            
$db->setQuery($query->__toString());

$db->loadObjectList(); 
esto " $db->loadObjectList();"