Ver Mensaje Individual
  #8 (permalink)  
Antiguo 17/07/2011, 09:04
luisgzafra
 
Fecha de Ingreso: noviembre-2010
Mensajes: 1.242
Antigüedad: 13 años, 5 meses
Puntos: 73
Respuesta: Extraer parecidos

Código SQL:
Ver original
  1. FUNCTION parecido ($q){
  2. $conexion = mysql_connect(HOSTDB, USERDB, PASSDB);
  3. mysql_select_db(NAMEDB, $conexion);
  4.  
  5. $queEmp = "SELECT * FROM queries WHERE query LIKE '%$q%'";
  6. $resEmp = mysql_query($queEmp, $conexion) OR die(mysql_error());
  7. $totEmp = mysql_num_rows($resEmp);
  8.  
  9. IF ($totEmp> 0) {
  10.     while ($rowEmp = mysql_fetch_assoc($resEmp)) {
  11.         RETURN $rowEmp['query'];
  12.    
  13.     }
  14. }
  15. }

Esta es la función que estoy utilizando.
__________________
:)