Foros del Web » Programando para Internet » PHP »

Como hago una busqueda BD fullTEXT?

Estas en el tema de Como hago una busqueda BD fullTEXT? en el foro de PHP en Foros del Web. Amigos acabo de encontrar una pagina que tiene codigo de PHP y ajax, la direccion es: http://www.baluart.net , el cual tienen un codigo fuente de ...
  #1 (permalink)  
Antiguo 22/06/2006, 14:18
Avatar de 8461277  
Fecha de Ingreso: diciembre-2002
Ubicación: san juan de los morros
Mensajes: 887
Antigüedad: 21 años, 4 meses
Puntos: 1
Como hago una busqueda BD fullTEXT?

Amigos acabo de encontrar una pagina que tiene codigo de PHP y ajax, la direccion es: http://www.baluart.net, el cual tienen un codigo fuente de un buscador con ajax, el cual es bastante sencillo y muy practico, el problema que tengo es el mismo lo hace a una BD mysql que tiene caracteristica desde el punto de vista mio muy especiales que yo nunca en visto y trabajado, yo logre conectar la BD y todo pero cuando deseo buscar algo me sale este error:
Can't find FULLTEXT index matching the column list

Segun lo que puedo entender es que mis campos no estan FULLTEXT o algo asi, el codigo fuente del php que hace esto es ele siguiente:
Código PHP:
<?php require_once('conexion.php'); 
$link=conectar();
?>
<?php
$maxRows_rsSearchResults 
10;
$pageNum_rsSearchResults 0;
if (isset(
$_GET['pageNum_rsSearchResults'])) {
  
$pageNum_rsSearchResults $_GET['pageNum_rsSearchResults'];
}
$startRow_rsSearchResults $pageNum_rsSearchResults $maxRows_rsSearchResults;

$SearchString_rsSearchResults "-1";
if (isset(
$_GET['SearchString'])) {
  
$SearchString_rsSearchResults = (get_magic_quotes_gpc()) ? $_GET['SearchString'] : addslashes($_GET['SearchString']);
}
mysql_select_db($database_connBlog$link);
$query_rsSearchResults sprintf("SELECT * FROM datos_personales1 WHERE MATCH (ci, nombre, apellido) AGAINST ('%%%s%%') ORDER BY ci DESC"$SearchString_rsSearchResults);
$query_limit_rsSearchResults sprintf("%s LIMIT %d, %d"$query_rsSearchResults$startRow_rsSearchResults$maxRows_rsSearchResults);
$rsSearchResults mysql_query($query_limit_rsSearchResults$link) or die(mysql_error());
$row_rsSearchResults mysql_fetch_assoc($rsSearchResults);

if (isset(
$_GET['totalRows_rsSearchResults'])) {
  
$totalRows_rsSearchResults $_GET['totalRows_rsSearchResults'];
} else {
  
$all_rsSearchResults mysql_query($query_rsSearchResults);
  
$totalRows_rsSearchResults mysql_num_rows($all_rsSearchResults);
}
$totalPages_rsSearchResults ceil($totalRows_rsSearchResults/$maxRows_rsSearchResults)-1;

$queryString_rsSearchResults "";
if (!empty(
$_SERVER['QUERY_STRING'])) {
  
$params explode("&"$_SERVER['QUERY_STRING']);
  
$newParams = array();
  foreach (
$params as $param) {
    if (
stristr($param"pageNum_rsSearchResults") == false && 
        
stristr($param"totalRows_rsSearchResults") == false) {
      
array_push($newParams$param);
    }
  }
  if (
count($newParams) != 0) {
    
$queryString_rsSearchResults "&" htmlentities(implode("&"$newParams));
  }
}
$queryString_rsSearchResults sprintf("&totalRows_rsSearchResults=%d%s"$totalRows_rsSearchResults$queryString_rsSearchResults);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>
<body>
<div id="contenido">
    <?php if ($totalRows_rsSearchResults 0) { // Show if recordset not empty ?>

    <?php do { ?>
    
<li><a href="http://www.tudominio.net/articulo.php?id=<?php echo $row_rsSearchResults['id_art'];?>"><?php echo str_replace($SearchString"<strong>$SearchString</strong>",$row_rsSearchResults['title_art']);?></a></li>

<?php } while ($row_rsSearchResults mysql_fetch_assoc($rsSearchResults));?>
<?php 
// Show if recordset not empty ?>
</div>
</body>
</html>
<?php
mysql_free_result
($rsSearchResults);
?>
el formulario de busqueda es el siguiente:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<
title>BaluArt.net Crear un LiveSearch con AjaxPHP y MySQL</title>
<
script type="text/javascript" src="livesearch.js"></script>
<style type="text/css">
body{background-color:#CAEAFF;}
.LSresult{
    background-color:#fff;
    width: 400px;
    margin:0;
    padding:0;
}
h1{
font-family:Georgia, "Times New Roman", Times, serif;
font-size:20px;}
p {
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;}
</style>
</head>

<body onload="liveSearchInit()" >
<div><h1>LIVESEARCH</h1></div>
<form onsubmit="return liveSearchSubmit()" name="searchform" method="get" action="./" id="searchform">
<input type="text" id="livesearch" name="q" size="15" onkeypress="liveSearchStart()" />
<div class="LSresult" id="LSResult">
<ul id="LSShadow"> </ul></div>
</form>
<div><p>Intenta con las siguientes palabras: Bienvenidos, Vintage, extensiones, recursos, u otras.</p>
<p>Aprende como crearlo con <a href="http://www.baluart.net/articulo.php?id_art=78">este tutorial</a></p>
</div>
</body>
</html> 
y el JS, es:

continua....
__________________
Miguel Padrón :cool:
  #2 (permalink)  
Antiguo 22/06/2006, 14:20
Avatar de 8461277  
Fecha de Ingreso: diciembre-2002
Ubicación: san juan de los morros
Mensajes: 887
Antigüedad: 21 años, 4 meses
Puntos: 1
Código PHP:
/*
// +----------------------------------------------------------------------+
// | Copyright (c) 2004 Bitflux GmbH                                      |
// +----------------------------------------------------------------------+
// | Licensed under the Apache License, Version 2.0 (the "License");      |
// | you may not use this file except in compliance with the License.     |
// | You may obtain a copy of the License at                              |
// | http://www.apache.org/licenses/LICENSE-2.0                           |
// | Unless required by applicable law or agreed to in writing, software  |
// | distributed under the License is distributed on an "AS IS" BASIS,    |
// | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or      |
// | implied. See the License for the specific language governing         |
// | permissions and limitations under the License.                       |
// +----------------------------------------------------------------------+
// | Author: Bitflux GmbH <[email protected]>                              |
// +----------------------------------------------------------------------+

*/
var liveSearchReq false;
var 
null;
var 
liveSearchLast "";
    
var 
isIE false;
// on !IE we only have to initialize it once
if (window.XMLHttpRequest) {
    
liveSearchReq = new XMLHttpRequest();
}

function 
liveSearchInit() {
    
    if (
navigator.userAgent.indexOf("Safari") > 0) {
        
document.getElementById('livesearch').addEventListener("keydown",liveSearchKeyPress,false);
//        document.getElementById('livesearch').addEventListener("blur",liveSearchHide,false);
    
} else if (navigator.product == "Gecko") {
        
        
document.getElementById('livesearch').addEventListener("keypress",liveSearchKeyPress,false);
        
document.getElementById('livesearch').addEventListener("blur",liveSearchHideDelayed,false);
        
    } else {
        
document.getElementById('livesearch').attachEvent('onkeydown',liveSearchKeyPress);
//        document.getElementById('livesearch').attachEvent("onblur",liveSearchHide,false);
        
isIE true;
    }
    
    
document.getElementById('livesearch').setAttribute("autocomplete","off");

}

function 
liveSearchHideDelayed() {
    
window.setTimeout("liveSearchHide()",400);
}
    
function 
liveSearchHide() {
    
document.getElementById("LSResult").style.display "none";
    var 
highlight document.getElementById("LSHighlight");
    if (
highlight) {
        
highlight.removeAttribute("id");
    }
}

function 
liveSearchKeyPress(event) {
    
    if (
event.keyCode == 40 )
    
//KEY DOWN
    
{
        
highlight document.getElementById("LSHighlight");
        if (!
highlight) {
            
highlight document.getElementById("LSShadow").firstChild.firstChild;
        } else {
            
highlight.removeAttribute("id");
            
highlight highlight.nextSibling;
        }
        if (
highlight) {
            
highlight.setAttribute("id","LSHighlight");
        } 
        if (!
isIE) { event.preventDefault(); }
    } 
    
//KEY UP
    
else if (event.keyCode == 38 ) {
        
highlight document.getElementById("LSHighlight");
        if (!
highlight) {
            
highlight document.getElementById("LSResult").firstChild.firstChild.lastChild;
        } 
        else {
            
highlight.removeAttribute("id");
            
highlight highlight.previousSibling;
        }
        if (
highlight) {
                
highlight.setAttribute("id","LSHighlight");
        }
        if (!
isIE) { event.preventDefault(); }
    } 
    
//ESC
    
else if (event.keyCode == 27) {
        
highlight document.getElementById("LSHighlight");
        if (
highlight) {
            
highlight.removeAttribute("id");
        }
        
document.getElementById("LSResult").style.display "none";
    } 
}
function 
liveSearchStart() {
    if (
t) {
        
window.clearTimeout(t);
    }
    
window.setTimeout("liveSearchDoSearch()",200);
}

function 
liveSearchDoSearch() {

    if (
typeof liveSearchRoot == "undefined") {
        
liveSearchRoot "";
    }
    if (
typeof liveSearchRootSubDir == "undefined") {
        
liveSearchRootSubDir "";
    }
    if (
typeof liveSearchParams == "undefined") {
        
liveSearchParams "";
    }
    if (
liveSearchLast != document.forms.searchform.q.value) {
    if (
liveSearchReq && liveSearchReq.readyState 4) {
        
liveSearchReq.abort();
    }
    if ( 
document.forms.searchform.q.value == "") {
        
liveSearchHide();
        return 
false;
    }
    if (
window.XMLHttpRequest) {
    
// branch for IE/Windows ActiveX version
    
} else if (window.ActiveXObject) {
        
liveSearchReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    
liveSearchReq.onreadystatechangeliveSearchProcessReqChange;
    
liveSearchReq.open("GET"liveSearchRoot "livesearch.php?SearchString=" document.forms.searchform.q.value liveSearchParams);
    
liveSearchLast document.forms.searchform.q.value;
    
liveSearchReq.send(null);
    }
}

function 
liveSearchProcessReqChange() {
    
    if (
liveSearchReq.readyState == 4) {
        var  
res document.getElementById("LSResult");
        
res.style.display "block";
        var  
sh document.getElementById("LSShadow");
        
        
sh.innerHTML liveSearchReq.responseText;
         
    }
}

function 
liveSearchSubmit() {
    var 
highlight document.getElementById("LSHighlight");
    if (
highlight && highlight.firstChild) {
        
window.location liveSearchRoot liveSearchRootSubDir highlight.firstChild.nextSibling.getAttribute("href");
        return 
false;
    } 
    else {
        return 
true;
    }

Por favor como puedo arreglar mi base de datos para que este codigo corra como dios manda

__________________
Miguel Padrón :cool:
  #3 (permalink)  
Antiguo 23/06/2006, 05:36
Avatar de 8461277  
Fecha de Ingreso: diciembre-2002
Ubicación: san juan de los morros
Mensajes: 887
Antigüedad: 21 años, 4 meses
Puntos: 1
Alguna idea por favor
__________________
Miguel Padrón :cool:
  #4 (permalink)  
Antiguo 23/06/2006, 18:08
Avatar de 8461277  
Fecha de Ingreso: diciembre-2002
Ubicación: san juan de los morros
Mensajes: 887
Antigüedad: 21 años, 4 meses
Puntos: 1
hcer una BD que tenga esa caracteristica de FULLTEXT
__________________
Miguel Padrón :cool:
  #5 (permalink)  
Antiguo 23/06/2006, 18:19
Avatar de B**
B**
 
Fecha de Ingreso: enero-2006
Ubicación: Monterrey,Mexico
Mensajes: 952
Antigüedad: 18 años, 3 meses
Puntos: 3
Hace tiempo me tope con eso....Mira para usar fulltext en un query, primero tu campo debe de aceptar esa propiedad, entonces a la hora de la definicion tienes que indicarle eso, algo parecido a esto:
CREATE TABLE articles (
-> id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
-> title VARCHAR(200),
-> body TEXT,
-> FULLTEXT (title,body)
-> );

Luego ya entonces cuando hagas un query para la busqueda fulltext ya funcionara..
Esta liga te ayudara mucho...
http://dev.mysql.com/doc/refman/5.0/...xt-search.html
Saludos..
__________________
-URL= Go PHP5.
-Age=22.
-Learning=PHP,J2EE,Struts,MAMBO,C++,JSON,AJAX,XHTML ,CSS.
  #6 (permalink)  
Antiguo 26/06/2006, 07:47
Avatar de 8461277  
Fecha de Ingreso: diciembre-2002
Ubicación: san juan de los morros
Mensajes: 887
Antigüedad: 21 años, 4 meses
Puntos: 1
B**, llevo ese sql a my MYSQl para crear una BD con esa caracteristica y me sale error, me podrias faciliatar otra forma de hacerlo por favor
__________________
Miguel Padrón :cool:
  #7 (permalink)  
Antiguo 26/06/2006, 08:23
Avatar de nosoynadie  
Fecha de Ingreso: noviembre-2005
Ubicación: dando vueltas por aquí
Mensajes: 206
Antigüedad: 18 años, 4 meses
Puntos: 1
Hola,
si no he entendido mal, el buscador no te funciona y te da este error a la hora de hacer la consulta "Can't find FULLTEXT index matching the column list"

Lo que parece suceder es que tu base de datos, más concretamente la tabla 'datos_personales1' no tiene definido ningún índica FULLTEXT. Lo que debes hacer es añadirselo.

Para ello, la ayuda de mysql dice que la sentencia a usar es:
Código:
ALTER [IGNORE] TABLE tbl_name ADD [FULLTEXT|SPATIAL] [INDEX] [index_name] (index_col_name,...)
en tu caso, creo, puede ser del siguiente modo:
Código:
alter tabla datos_personales1 add fulltext(ci, nombre, apellido)
Prueba y nos dices, ciao
__________________
http://www.nosoynadie.net/
  #8 (permalink)  
Antiguo 26/06/2006, 08:55
Avatar de 8461277  
Fecha de Ingreso: diciembre-2002
Ubicación: san juan de los morros
Mensajes: 887
Antigüedad: 21 años, 4 meses
Puntos: 1
Nosoynadie, gracias por ayudarme, eso es lo que no hacer hacer, coloco el comando SQL que me dijiste dentro de la tabla datos_personales1 y me arroja este error:

consulta SQL:

ALTER tabla datos_personales1 ADD FULLTEXT (

ci,
nombre,
apellido
)
MySQL ha dicho:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tabla datos_personales1 add fulltext(ci, nombre, apellido)' at line 1

Me ayudas por favor
__________________
Miguel Padrón :cool:
  #9 (permalink)  
Antiguo 26/06/2006, 09:26
Avatar de nosoynadie  
Fecha de Ingreso: noviembre-2005
Ubicación: dando vueltas por aquí
Mensajes: 206
Antigüedad: 18 años, 4 meses
Puntos: 1
Cita:
Iniciado por 8461277
Nosoynadie, gracias por ayudarme, eso es lo que no hacer hacer, coloco el comando SQL que me dijiste dentro de la tabla datos_personales1 y me arroja este error:

ALTER tabla datos_personales1 ADD FULLTEXT (
ci,
nombre,
apellido
)

Perdona, te lo escribí mal (falta TABLE después de ALTER)
Código:
ALTER TABLE tabla datos_personales1 ADD FULLTEXT (
ci,
nombre,
apellido
)
__________________
http://www.nosoynadie.net/
  #10 (permalink)  
Antiguo 26/06/2006, 09:35
Avatar de 8461277  
Fecha de Ingreso: diciembre-2002
Ubicación: san juan de los morros
Mensajes: 887
Antigüedad: 21 años, 4 meses
Puntos: 1
me sale est error:

consulta SQL:

ALTER TABLE tabla datos_personales1 ADD FULLTEXT (

nombre,
apellido,
ci
)
MySQL ha dicho:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'datos_personales1 ADD FULLTEXT (
nombre,
apellido,
ci
)' at line 1

ACOTO, que mi tabla es de tipi:INNODB, no se si eso afecta a lo que estamos tratando de hacer, otra sugerencia plissss

Me puedes decir como hago una BD desde el principio con esta caracteristicas de FULLTEXT???
__________________
Miguel Padrón :cool:
  #11 (permalink)  
Antiguo 26/06/2006, 09:41
Avatar de nosoynadie  
Fecha de Ingreso: noviembre-2005
Ubicación: dando vueltas por aquí
Mensajes: 206
Antigüedad: 18 años, 4 meses
Puntos: 1
el hecho de que tu tabla sea InnoDB está impidiendo la creación del índice FULLTEXT. Para pode hacerlo,según dicen en [1], la tabla ha de ser MySAM. En este documento te lo explican todo muy bien

P.D. siento haberte liado tanto

[1] http://www.mysql-hispano.org/page.php?id=15&pag=1
__________________
http://www.nosoynadie.net/
  #12 (permalink)  
Antiguo 26/06/2006, 09:48
Avatar de 8461277  
Fecha de Ingreso: diciembre-2002
Ubicación: san juan de los morros
Mensajes: 887
Antigüedad: 21 años, 4 meses
Puntos: 1
Ok pana lo probare y te aviso, gracias y espero contar simepre contigo
__________________
Miguel Padrón :cool:
  #13 (permalink)  
Antiguo 26/06/2006, 09:58
Avatar de nosoynadie  
Fecha de Ingreso: noviembre-2005
Ubicación: dando vueltas por aquí
Mensajes: 206
Antigüedad: 18 años, 4 meses
Puntos: 1
Cita:
Iniciado por 8461277
Ok pana lo probare y te aviso, gracias y espero contar simepre contigo
de nada hombre, para eso estamos
__________________
http://www.nosoynadie.net/
  #14 (permalink)  
Antiguo 26/06/2006, 12:01
Avatar de 8461277  
Fecha de Ingreso: diciembre-2002
Ubicación: san juan de los morros
Mensajes: 887
Antigüedad: 21 años, 4 meses
Puntos: 1
Amigo, nosoynadie, relize lo que me dijiste y funciona ya se crear una BD con fulltext, pero cuando al formulario le digo buscar no me trae nada:

El formulario es este:

Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<
title>BaluArt.net Crear un LiveSearch con AjaxPHP y MySQL</title>
<
script type="text/javascript" src="livesearch.js"></script>
<style type="text/css">
body{background-color:#CAEAFF;}
.LSresult{
    background-color:#fff;
    width: 400px;
    margin:0;
    padding:0;
}
h1{
font-family:Georgia, "Times New Roman", Times, serif;
font-size:20px;}
p {
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;}
</style>
</head>

<body onload="liveSearchInit()" >
<div><h1>LIVESEARCH</h1></div>
<form onsubmit="return liveSearchSubmit()" name="searchform" method="get" action="./" id="searchform">
<input type="text" id="livesearch" name="q" size="15" onkeypress="liveSearchStart()" />
<div class="LSresult" id="LSResult">
<ul id="LSShadow"> </ul></div>
</form>
<div><p>Intenta con las siguientes palabras: Bienvenidos, Vintage, extensiones, recursos, u otras.</p>
<p>Aprende como crearlo con <a href="http://www.baluart.net/articulo.php?id_art=78">este tutorial</a></p>
</div>
</body>
</html> 
el que relaiza la busqueda es este:
Código PHP:
<?php require_once('conexion.php'); 
$link=conectar();
?>
<?php
$maxRows_rsSearchResults 
10;
$pageNum_rsSearchResults 0;
if (isset(
$_GET['pageNum_rsSearchResults'])) {
  
$pageNum_rsSearchResults $_GET['pageNum_rsSearchResults'];
}
$startRow_rsSearchResults $pageNum_rsSearchResults $maxRows_rsSearchResults;

$SearchString_rsSearchResults "-1";
if (isset(
$_GET['SearchString'])) {
  
$SearchString_rsSearchResults = (get_magic_quotes_gpc()) ? $_GET['SearchString'] : addslashes($_GET['SearchString']);
}
mysql_select_db($database_connBlog$link);
$query_rsSearchResults sprintf("SELECT * FROM lala WHERE MATCH (ci, nombre, apellido) AGAINST ('%%%s%%') ORDER BY ci DESC"$SearchString_rsSearchResults);
$query_limit_rsSearchResults sprintf("%s LIMIT %d, %d"$query_rsSearchResults$startRow_rsSearchResults$maxRows_rsSearchResults);
$rsSearchResults mysql_query($query_limit_rsSearchResults$link) or die(mysql_error());
$row_rsSearchResults mysql_fetch_assoc($rsSearchResults);

if (isset(
$_GET['totalRows_rsSearchResults'])) {
  
$totalRows_rsSearchResults $_GET['totalRows_rsSearchResults'];
} else {
  
$all_rsSearchResults mysql_query($query_rsSearchResults);
  
$totalRows_rsSearchResults mysql_num_rows($all_rsSearchResults);
}
$totalPages_rsSearchResults ceil($totalRows_rsSearchResults/$maxRows_rsSearchResults)-1;

$queryString_rsSearchResults "";
if (!empty(
$_SERVER['QUERY_STRING'])) {
  
$params explode("&"$_SERVER['QUERY_STRING']);
  
$newParams = array();
  foreach (
$params as $param) {
    if (
stristr($param"pageNum_rsSearchResults") == false && 
        
stristr($param"totalRows_rsSearchResults") == false) {
      
array_push($newParams$param);
    }
  }
  if (
count($newParams) != 0) {
    
$queryString_rsSearchResults "&" htmlentities(implode("&"$newParams));
  }
}
$queryString_rsSearchResults sprintf("&totalRows_rsSearchResults=%d%s"$totalRows_rsSearchResults$queryString_rsSearchResults);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>
<body>
<div id="contenido">
    <?php if ($totalRows_rsSearchResults 0) { // Show if recordset not empty ?>

    <?php do { ?>
    
<li><a href="http://www.tudominio.net/articulo.php?id=<?php echo $row_rsSearchResults['id_art'];?>"><?php echo str_replace($SearchString"<strong>$SearchString</strong>",$row_rsSearchResults['title_art']);?></a></li>

<?php } while ($row_rsSearchResults mysql_fetch_assoc($rsSearchResults));?>
<?php 
// Show if recordset not empty ?>
</div>
</body>
</html>
<?php
mysql_free_result
($rsSearchResults);
?>
porque sera me explica?
__________________
Miguel Padrón :cool:
  #15 (permalink)  
Antiguo 26/06/2006, 12:50
Avatar de nosoynadie  
Fecha de Ingreso: noviembre-2005
Ubicación: dando vueltas por aquí
Mensajes: 206
Antigüedad: 18 años, 4 meses
Puntos: 1
Hola,

haz un echo de $query_limit_rsSearchResults, copia la salida en pantalla, llevala al phpmyadmin, ejecutala y mira a ver si trae algún resultado. En caso de que si, el problema está en el códgio php sino está en la consulta.

Prueba y dime, mientras sigo mirando el código
__________________
http://www.nosoynadie.net/
  #16 (permalink)  
Antiguo 26/06/2006, 12:58
Avatar de 8461277  
Fecha de Ingreso: diciembre-2002
Ubicación: san juan de los morros
Mensajes: 887
Antigüedad: 21 años, 4 meses
Puntos: 1
Me sale esto:

Su consulta se ejecutó con éxito (La consulta tardó 0.0032 seg)
consulta SQL:
SELECT *
FROM lala
WHERE MATCH (
ci, nombre, apellido
)
AGAINST (
'%9883255%'
)
ORDER BY ci DESC
LIMIT 0 , 10
[Editar] [Explicar el SQL] [Crear código PHP] [Actualizar]
__________________
Miguel Padrón :cool:
  #17 (permalink)  
Antiguo 26/06/2006, 13:04
Avatar de nosoynadie  
Fecha de Ingreso: noviembre-2005
Ubicación: dando vueltas por aquí
Mensajes: 206
Antigüedad: 18 años, 4 meses
Puntos: 1
Dices que la salida es:
Código:
Su consulta se ejecutó con éxito (La consulta tardó 0.0032 seg)
consulta SQL:
SELECT *
FROM lala
WHERE MATCH (
ci, nombre, apellido
)
AGAINST (
'%9883255%'
)
ORDER BY ci DESC
LIMIT 0 , 10
si te fijas, donde habla del tiempo empleado, no comenta nada de la cantidad de resultados que ha encontrado. Eso es porqeu no encuentra nada. Revisa la construcción de la condición de búsqueda, fijate bien en el documento q te pasé antes y afina la condición.

La condición que le dices es que te busque un elemento que tenga en alguno de los campos ci, nombre, apellido la cadena '9883255' ¿es esta la búsqueda que estás haciendo?
__________________
http://www.nosoynadie.net/
  #18 (permalink)  
Antiguo 26/06/2006, 13:17
Avatar de 8461277  
Fecha de Ingreso: diciembre-2002
Ubicación: san juan de los morros
Mensajes: 887
Antigüedad: 21 años, 4 meses
Puntos: 1
...La condición que le dices es que te busque un elemento que tenga en alguno de los campos ci, nombre, apellido la cadena '9883255' ¿es esta la búsqueda que estás haciendo?....

Si es esa la que busco, es decir que al encontrar la cedula ella debe arrojar todas aquellas que empience con 9*******
__________________
Miguel Padrón :cool:
  #19 (permalink)  
Antiguo 26/06/2006, 13:21
Avatar de nosoynadie  
Fecha de Ingreso: noviembre-2005
Ubicación: dando vueltas por aquí
Mensajes: 206
Antigüedad: 18 años, 4 meses
Puntos: 1
son muchas las que comienzan con 9*? Lo digo por el tema del 'ruido' en estas búsquedas. Mira lo que dicen en el documento que te pasé:

Esta otra consulta busca los artículos que traten acerca de MySQL.

mysql> SELECT id, titulo, contenido FROM articulos
-> WHERE MATCH(titulo,contenido) AGAINST('MySQL');
Empty set (0.00 sec)

IMPORTANTE: en la consulta anterior no se regresó ningún resultado a pesar de que la palabra "MySQL" aparece en todos los registros que insertamos, esto se debe a que las palabras que aparecen en más del 50% de los campos son consideradas palabras que "hacen ruido", y no se toman en cuenta.
__________________
http://www.nosoynadie.net/
  #20 (permalink)  
Antiguo 26/06/2006, 13:22
Avatar de nosoynadie  
Fecha de Ingreso: noviembre-2005
Ubicación: dando vueltas por aquí
Mensajes: 206
Antigüedad: 18 años, 4 meses
Puntos: 1
lo siento pero he de dejarte. Te recomiendo que te leas atentamente el documento de antes (el enlace) en el te cuentan 'detalles' importantes de este tipo de búsqueda. Mañana sigo Ciao
__________________
http://www.nosoynadie.net/
  #21 (permalink)  
Antiguo 26/06/2006, 13:32
Avatar de 8461277  
Fecha de Ingreso: diciembre-2002
Ubicación: san juan de los morros
Mensajes: 887
Antigüedad: 21 años, 4 meses
Puntos: 1
ok hermano leere y te aviso mañana
__________________
Miguel Padrón :cool:
  #22 (permalink)  
Antiguo 26/06/2006, 13:42
Avatar de 8461277  
Fecha de Ingreso: diciembre-2002
Ubicación: san juan de los morros
Mensajes: 887
Antigüedad: 21 años, 4 meses
Puntos: 1
Cuando mando imprimir otra variable como:
$rsSearchResults = mysql_query($query_limit_rsSearchResults, $link) or die(mysql_error());
Me da como resultado: Resource id #5 , esto te llo dejo para mañana yo tratare de encontrar algo cono los datos del tutorial, recuerda que este codigo lo encontre en la pagina que esta arriba, y que tiene AJAX, PHP, JS Y MYSQL
__________________
Miguel Padrón :cool:
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 22:38.