Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

fsales_123

anuncios

Recommended Posts

boa noite, como faço para colocar o anuncio um do lado do outro? eu até consegui, mas ele repete o anuncio, QUERIA qe ele mostrasse todos o registros de anuncio mais qe ficasse um do lado do outro.. \/..

 

é assim meu anuncio fica como uma filheira e eu quero deixar um assim ex:

 

como está

 

ANUNCIO

ANUNCIO

ANUNCIO

ANUNCIO

ANUNCIO

 

COMO EU QUERO DEIXAR

 

 

ANUNCIO ANUNCIO

ANUNCIO ANUNCIO

ANUNCIO ANUNCIO

 

CODIGO ABAIXO.

<?php 
 
 	if(@$_POST){
			$sql = mysql_query("SELECT * FROM anuncios WHERE descricao LIKE '%".$_POST["query"]."%' ORDER BY ID DESC");
	}else{
 
		if(empty($_GET["categoria"])){
			$sql = mysql_query("SELECT * FROM anuncios WHERE status = 'Ativo' AND ID ORDER BY RAND() LIMIT 10");
		}else{
			$sql = mysql_query("SELECT * FROM anuncios WHERE categoria = '".strip_tags($_GET["categoria"])."' AND status = 'Ativo' ORDER BY nome ASC");
		}
	}
	
			if(mysql_num_rows($sql) == false){
				echo '<div align="center"><br /><strong>Nenhum anúncio encontrado.</strong><br /></div>';
			}else{
				while($ln = mysql_fetch_object($sql)){
	?>
      <table width="100%" border="0">
         <tr>
           <td width="2%" height="110" align="center" valign="middle"><img src="uploads/<?php echo $ln->thumb; ?>" width="140" height="90" /></td>
           <td width="98%" align="left" valign="top">
           <div align="left" style="margin:5px; font-size:11px;"><?php echo truncate(strip_tags($ln->descricao), 150); ?>...</div>
           <div align="left" style="margin:5px; font-size:11px;">Telefone: <strong><?php echo $ln->telefone; ?></strong></div>
           <div align="left" style="margin:5px; font-size:11px;">Data: <strong><?php echo str_replace("-", "/", inverteData($ln->data)); ?></strong></div>
           <div align="left" style="margin:5px; font-size:11px;">Enviado por: <strong><?php echo $ln->nome; ?></strong></div>
           <div align="left" style="margin-left:5px; margin-top:10px;"><a href="javascript: ver_anuncio(<?php echo $ln->ID; ?>);" class="botao" style="text-decoration:none;">Ver anúncio</a></div>
           </td>
         </tr>
      </table>
      
         

    </td>
    <td align="left" valign="top"><p> </p>
    <p> </p>
    <p><?php 
 
 	if(@$_POST){
			$sql = mysql_query("SELECT * FROM anuncios WHERE descricao LIKE '%".$_POST["query"]."%' ORDER BY ID DESC");
	}else{
 
		if(empty($_GET["categoria"])){
			$sql = mysql_query("SELECT * FROM anuncios WHERE status = 'Ativo' AND ID ORDER BY RAND() LIMIT 10");
		}else{
			$sql = mysql_query("SELECT * FROM anuncios WHERE categoria = '".strip_tags($_GET["categoria"])."' AND status = 'Ativo' ORDER BY nome ASC");
		}
	}
	
			if(mysql_num_rows($sql) == false){
				echo '<div align="center"><br /><strong>Nenhum anúncio encontrado.</strong><br /></div>';
			}else{
				while($ln = mysql_fetch_object($sql)){
	?>
    <table width="100%" border="0">
         <tr>
           <td width="2%" height="110" align="center" valign="middle"><img src="uploads/<?php echo $ln->thumb; ?>" width="140" height="90" /></td>
           <td width="98%" align="left" valign="top">
           <div align="left" style="margin:5px; font-size:11px;"><?php echo truncate(strip_tags($ln->descricao), 150); ?>...</div>
           <div align="left" style="margin:5px; font-size:11px;">Telefone: <strong><?php echo $ln->telefone; ?></strong></div>
           <div align="left" style="margin:5px; font-size:11px;">Data: <strong><?php echo str_replace("-", "/", inverteData($ln->data)); ?></strong></div>
           <div align="left" style="margin:5px; font-size:11px;">Enviado por: <strong><?php echo $ln->nome; ?></strong></div>
           <div align="left" style="margin-left:5px; margin-top:10px;"><a href="javascript: ver_anuncio(<?php echo $ln->ID; ?>);" class="botao" style="text-decoration:none;">Ver anúncio</a></div>
           </td>
         </tr>
      </table>
      
               <?php
			}
			?>
                <?php
				}
				?>

    </td></p></td>

 

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

Você está colocando uma tabela com 100% de largura, logo é isto que vai ocorrer.... a sua questão está ligada à semântica do HTML que está errada, vou mover para a área correta.

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.