Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/04/2010, 00:07
moz90
 
Fecha de Ingreso: mayo-2009
Mensajes: 94
Antigüedad: 15 años
Puntos: 0
Sonrisa Haciendo Buscador de PHP con MYSQL, ayuda plis.

hola amigos foreros, weno aqui nuevamente pidiendoles ayuda, estoy haciendo mi pagina web personal, y en la seccion del menu Musica-lista de material estoy haciendo un buscador para buscar entre 250 registros aprox. buscar por artista; atra vez de un cuadro de texto y me muestre los resultados en una mismo archivo o nose acepto sugerencias... amigos....

Lo quiero hacer de la manera q funciona foros torrents, donde se muestran todos registros luego cuando buscas alguna material te muestra los resultados...weno basicamente qiero q haga la busqueda luego se adicionan los detalles...aqui ya avance un poco

www.vision-web.tk o vision-web.webcindario.com

Codigo:

Código PHP:
   <?php 
// conectar al servidor 
 
include("conexiones.php");
// varificamos que el formulario halla sido enviado 
if(isset($_GET['buscar']) && $_GET['buscar'] == 'Buscar'){ 
    
$frase addslashes($_GET['frase']); 
    
// hacemos la consulta de busqueda 
    
$sqlBuscar mysql_query("SELECT id, artista, detalle, FROM material WHERE artista=$frase"$connect) or die(mysql_error());
    
$totalRows mysql_num_rows($sqlBuscar); 
    
// Enviamos un mensaje 
    // indicando la cantidad de resultados ($totalRows) 
    // para la frase busada ($frase) 
    
if(!empty($totalRows)){ 
        echo 
stripslashes("<p>Su b&uacute;squeda arroj&oacute; <strong>$totalRows</strong> resultados para <strong>$frase</strong></p>");         
        
// mostramos los resultados 
        
while($row mysql_fetch_array($sqlBuscar)){ 
        echo 
'<tr>';
        echo 
'<td>'.$row["id"].'</td>';  
        echo 
'<td>'.$row["artista"].'</td>';
        echo 
'<td>'.$row["detalles"].'</td>';
        echo 
'<td>'.$row["fuente"].'</td>';
        echo 
'<td>'.$row["duracion"].' Minutos</td>';
        echo 
'</tr>';
        
        } 
    } 
    
// si se ha enviado vacio el formulario 
    // mostramos un mensaje del tipo Oops...! 
    
elseif(empty($_GET['frase'])){ 
        echo 
"Debe introducir una palabra o frase."
    } 
    
// si no hay resultados 
    // otro mensaje del tipo Oops...! 
    
elseif($totalRows == 0){ 
        echo 
stripslashes("Su busqueda no arrojo resultados para <strong>$frase</strong>"); 
    } 

?> 
        
          <form id="form1" name="buscar" method="get" action="<?php $_SERVER['PHP_SELF'?>">
            <p>Buscar 
              <input type="text" name="frase" id="frase" value="<?php echo $_GET['frase']; ?>"/>
              
              <input type="submit" name="enviar" id="button" value="Buscar!" />
            </p>
          </form>
    
          
         
       <table cellspacing="0" cellpadding="0" width="101%">
        <tr>
          <th width="4%" class="lefthead">N&ordm;</th>
          <th width="18%">Banda \ Solista</th>
          <th width="55%">Lugar, Fecha</th>
          <th width="10%">Fuente</th>
          <th width="13%" class="righthead">Duraci&oacute;n</th>
        </tr>         
 <?php
    
include("conexiones.php");

    
//hacemos las consultas
    
$result=mysql_query("select * from material"$connect);
    
$tregistros=mysql_num_rows($result);

 while(
$row=mysql_fetch_array($result))
   {
echo 
'<tr>';
echo 
'<td>'.$row["id"].'</td>';  
echo 
'<td>'.$row["artista"].'</td>';
echo 
'<td>'.$row["detalles"].'</td>';
echo 
'<td>'.$row["fuente"].'</td>';
echo 
'<td>'.$row["duracion"].' Minutos</td>';
echo 
'</tr>';
}
mysql_free_result($result);
 
 
?>
el codigo de la primera parte la cogi de los aportes de php...pero no me funciona....a ver si alguien me hecha una mano

salu2