Ver Mensaje Individual
  #5 (permalink)  
Antiguo 16/01/2010, 10:24
kirst
 
Fecha de Ingreso: septiembre-2009
Mensajes: 230
Antigüedad: 14 años, 7 meses
Puntos: 2
Respuesta: [Ayuda] Buscar????

sigue sin arreglarse, y así quedó:

Código PHP:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-11724842-1");
pageTracker._trackPageview();
} catch(err) {}</script>
<div align="center"><form action="index.php?m=buscar" method="post">
    <fieldset>
              Búsqueda de texto<br>
      <input name="palabra">
              <input type="submit" value=" " name="buscador" class="busqboton" />
                </fieldset>
</form></div>
<?PHP
if ($_POST['buscador'])
{
// Tomamos el valor ingresado
$buscar    =    $_POST['palabra'];
// Si está vacío, lo informamos, sino realizamos la búsqueda
if(empty($_POST['palabra']))
{
echo 
"No se ha ingresado una cadena a buscar";
}
else
{
    
//require 'm/delivery/admin/conexion.php';

$query "SELECT * FROM noticias WHERE noticias.copete like '".$_POST['palabra']."' OR noticias.cuerpo like '".$_POST['palabra']."' ORDER BY idNoticia DESC";
$arrNoticias = array();
$resultado mysql_query ($query$dbConn);
while ( 
$row mysql_fetch_assoc ($resultado))
{
    
array_push$arrNoticias,$row );
    
$total $arrNoticias;
}

// Tomamos el total de los resultados
//$total = mysql_num_rows($result);
// Imprimimos los resultados
//if ($row = mysql_fetch_array($result)){
    
    
if ($total 0){
echo 
"<p>Resultados para: <b>$buscar</b></p>";
do {
//ACA SE MOSTRARAN LOS RESULTADOS ENCONTRADOS
?>
    <? foreach ( $arrNoticias as $noticias ) { ?>
<div align="center">
  <table width="95%" border="0" cellspacing="0" cellpadding="0" class="tbl1">
    <tr>
      <td width="5%" height="85" rowspan="2" class="tbl1"><img src="img/articulos/<? echo $noticias['titulo']; ?>" width="120" height="85"></td>
      <td width="60%" height="18" align="left" class="art2"><? echo $noticias['copete']; ?></td>
      <td width="40%" align="right" style="padding:2px">
<script>
function abrirPopUp(href, target, flags) {
if (flags=='') flags='chrome,centerscreen,dependent=YES,dialog=no,toolbar=0,resizable=YES,scrollbars=YES,location=0,status=0,menubar=0,toolbar=0,width=600px,height=500px,modal=yes,left = NaN,top = NaN';
if (target=='')
target='_blank';
window.open(href,target,flags);

</script>
<?PHP
if(!empty($noticias['tipo']) ) {
?>
            <a href="#" onClick="abrirPopUp('articulos.php?blog=<? echo $noticias['tipo']; ?>&idNoticia=<? echo $noticias['idNoticia']; ?>','','')"><img src="img/detalle.png" width="41" height="27" border="0" /></a>
<?PHP
}
?>
<?PHP
if(!empty($noticias['coordenada1']) && !empty($noticias['coordenada2']) ) {
?>
<a href="index.php?m=maps&coordenada1=<? echo $noticias['coordenada1']; ?>&coordenada2=<? echo $noticias['coordenada2']; ?>&empresa=<? echo $noticias['copete']; ?>&domicilio=<? echo $noticias['domicilio']; ?>&link=<? echo $noticias['link']; ?>"><img src="img/ubicacion.png" width="65" height="27" border="0" /></a>
<?PHP ?>
<?PHP
if(!empty($noticias['link']) ) {
?>
            <a href="http://<? echo $noticias['link']; ?>"><img src="img/WWW.png" width="57" height="27" border="0" /></a>
<?PHP
}
?>
      </td>
    </tr>
    <tr>
      <td colspan="2" class="art1">
      <? echo $noticias['cuerpo']; ?> <br  />
      <? echo $noticias['domicilio']; ?> <br />
      <? echo $noticias['horario']; ?> <br  />
      (0291) - <? echo $noticias['telefono']; ?>
      </td>
    </tr>
  </table>
</div>
<br  />

<?PHP ?>
<?
} while ($row mysql_fetch_array($resultado));
//echo "<p>Resultados: $row</p>";
} else {
// En caso de no encontrar resultados
echo "No se encontraron resultados para: <b>$buscar</b>";
}
}
}
?>