Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php/mysql] zliczanie wyników wyszukiwania
Rico_ds
post
Post #1





Grupa: Zarejestrowani
Postów: 84
Pomógł: 0
Dołączył: 21.03.2007

Ostrzeżenie: (0%)
-----


Witam,
mam taki kod
  1. <div id="results">
  2.  
  3. <?php
  4.  
  5. echo'<div id="pap"><img src="img/paper.jpg"></div><div class="p4">SEARCH RESULTS</div><br/>';
  6. echo'<div id="ile">There is results</div>';
  7.  
  8. $_POST['what']=trim($_POST['what']);
  9.  
  10. if(empty($_POST['what']))
  11.  
  12. die('Search string is empty. Please try again');
  13.  
  14. else
  15. {
  16.  
  17. $base=mysqli_connect('localhost','root','vertrigo','020london');
  18.  
  19. $query="Select * From companys Where name Like '%{$_POST['what']}%' Or description Like '%{$_POST['what']}%' Or address Like '%{$_POST['where']}%' Or postcode Like '%{$_POST['where']}%'";
  20.  
  21. $result=mysqli_query($base,$query);
  22. while($row=mysqli_fetch_assoc($result))
  23. {
  24.  
  25. $company_id = $row["id"]; 
  26. $name = $row["name"];
  27. $address = $row["address"];
  28. $postcode = $row["postcode"];
  29. $location = $row["location"];
  30.  
  31. echo '<div id="wyniki">';
  32. echo '<table>';
  33. echo '<tr =><td nowrap><div class="p5">'.$row["name"].'</div></td><td nowrap><div class="p6">'.$row["address"].'</div></td><td nowrap><div class="p6">'.$row["postcode"].'</div></td></tr>';
  34. echo '</table>';
  35. echo '</div>';
  36. }
  37.  
  38. mysqli_close($base);
  39. }
  40.  
  41. ?>
  42.  
  43. </div>

jak moge zliczyc ilosc wyswietlonych wynikow, aby wstawic je w
  1. <?php
  2. echo'<div id="ile">There is results</div>';
  3. ?>

p.s co moge zmienic, aby wyszukiwarka podawala tylko wyniki do danego zapytania bo po wpisaniu hotel, poza hotelami dostalem tez np. Dulwich Acupuncture - akupunkture

Ten post edytował Rico_ds 28.08.2007, 14:18:29
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.09.2025 - 03:16