Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <input name="name" type="text" placeholder="Buscar...">
  2. <input value="Buscar" type="submit">
  3. </form>
  4. <?php
  5. include("global.php");
  6. require_once("zebra.php");
  7. if (empty($_GET['name'])) { $name="";} else { $name=$_GET['name'];}
  8.  
  9. $query = "SELECT * , MATCH (nom, des) AGAINST ('$name') AS puntuacion FROM webs WHERE MATCH (nom, des) AGAINST ('$name') ORDER BY puntuacion DESC LIMIT 50 " or die(mysqli_error());
  10. $res = $con->query($query);
  11. $num_registros = mysqli_num_rows($res);
  12.  
  13. $resul_x_pagina = 5;
  14.  
  15. $paginacion = new Zebra_Pagination();
  16. $paginacion->records($num_registros);
  17. $paginacion->records_per_page($resul_x_pagina);
  18.  
  19. $consulta = "SELECT * , MATCH (nom, des) AGAINST ('$name') AS puntuacion FROM webs WHERE MATCH (nom, des) AGAINST ('$name') ORDER BY puntuacion DESC LIMIT 50 " die(mysqli_error());
  20. .(($paginacion->get_page() - 1) * $resul_x_pagina). "," .$resul_x_pagina;
  21. $result = $con->query($consulta);
  22.  
  23. while($row = mysqli_fetch_array($result)){
  24. echo "<a href="$row[nom]" target="_blank">$row[nom]</a><br>";
  25. echo $row['des']."<br><br>";
  26. }
  27.  
  28. $paginacion->render();
  29. mysqli_close($con);
  30.  
  31. ?>
  32.  
  33. He busado por todos lados y creo que la consulta
  34.  
  35. Es correcta, pero solo funciona si le añado die(mysqli_error());
  36. Si en vez de consultas con match las hago con like no tengo problemas.
  37.  
  38. Alguna idea? Muchas gracias
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement