<?
$can = 0;
include('concha.php');
mysql_connect ("$host", "$usuario", "$contra");
mysql_select_db ("$basedatos");
$sql = "SELECT * FROM avisos WHERE ver = 'si' AND IDC = '$cat' ORDER BY rand() LIMIT 40";
$consulta = mysql_query ($sql);
while ($row = mysql_fetch_array($consulta))
{
    $ID = $row["ID"];
    $titulo = $row["titulo"];
    $linea1 = $row["linea1"];
    $linea2 = $row["linea2"];
    $IDC = $row["IDC"];
    $IDS = $row["IDS"];
    $userp = $row["user"];
    $can = $can + 1;
    $foto = $row["foto"]; $ext_img = $row["ext_img"];

 ?>




        <div class="col-12">

          
                  <div align="left" class="Estilo42"><strong><?php echo $titulo ?></strong></div>
            
              

                    
            
                          
                        <? if ($foto == NULL) {} else {?>
                      
                            <img src="upload_pic/resize_<?php echo $foto ?>.jpg" />
                      
                        <? };?>
                      
             


                      <p><?php echo $linea1 ?></p>

                 




                      <p><?php echo $linea2 ?></p>


                    



                 <?php   



                    $sql2 = "SELECT * FROM cla_categorias WHERE ID = $IDC";
                    $consulta2 = mysql_query ($sql2);
                    while ($row2 = mysql_fetch_array($consulta2))
                    {
                    $nombrecat = $row2["nombre"];
                    }
                    mysql_free_result($consulta2);
                    $sql3 = "SELECT * FROM subcategorias where ID = $IDS";
                    $consulta3 = mysql_query ($sql3);
                    while ($row3 = mysql_fetch_array($consulta3))
                    {
                    $nombresub = $row3["nombresub"];
                    }
                    mysql_free_result($consulta3);?>


                          <p>&raquo; <?php echo $nombrecat ?> &raquo; <?php echo $nombresub ?></p>
                          
                
                          <a href="anuncio.php?ID=<?php echo $ID ?>">Ver Anuncio</a>

        </div>

        <? 
    
        } mysql_free_result($consulta);
        ?>

 

           <div align="center"><br />

          <? if ($can == 0) { ?>

            <span class="Estilo42"> AUN NO HAY AVISOS PUBLICADOS EN ESTE RUBRO</span> 

          <? } ?>

          

        </div>

