Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php][mysql] Problem z wyszukiwaniem
mac1us
post
Post #1





Grupa: Zarejestrowani
Postów: 39
Pomógł: 0
Dołączył: 1.08.2007

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


Witam. Mam nastepujacy skrypt wyszukiwania:
  1. <?php
  2. include "auth_admin.inc.php";
  3. include "conn.inc.php";
  4. ?>
  5. <html>
  6. <head>
  7. <title>Panel administracyjny</title>
  8. <style type="text/css">
  9. body {
  10.  background-color: #87CEFA;
  11. }  a img{
  12. border: none;}
  13. td { color:navy; font-weight: bold;}
  14. p {color:navy; font-weight: bold;}
  15. a
  16. {
  17. color: navy;
  18. }
  19.  
  20. a:hover
  21. {
  22. color: red;
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <h2>Wyszukiwarka</h2>
  28. <form name="search" method="post" action="<?=$PHP_SELF?>">
  29. Szukaj <input type="text" name="find" /> w rekordzie
  30. <Select NAME="field">
  31. <Option VALUE="nazwa">nazwa</option>
  32. <Option VALUE="adres">adres</option>
  33. <Option VALUE="miasto">miasto</option>
  34. </Select>
  35. <input type="hidden" name="searching" value="yes" />
  36. <input type="submit" name="search" value="Search" />
  37. </form>
  38.  
  39. <?
  40. if ($searching =="yes")
  41. {
  42. echo "<h2>Wyniki</h2><p>";
  43.  
  44. if ($find == "")
  45. {
  46. echo "<p>Nie wpisales nic w pole zapytania";
  47. }
  48.  
  49. mysql_connect("xxxxx", "xxxxx", "xxxxxx") or die(mysql_error());
  50. mysql_select_db("xxxxxxx") or die(mysql_error());
  51.  
  52. $find = strtoupper($find);
  53. $find = strip_tags($find);
  54. $find = trim ($find);
  55.  
  56. $data = mysql_query("SELECT * FROM laboratoria WHERE upper($field) LIKE'%$find%'");
  57.  
  58. while($result = mysql_fetch_array( $data ))
  59. {
  60. echo $result['nazwa'];
  61. echo "<br>";
  62. echo $result['adres'];
  63. echo "<br>";
  64. echo $result['miasto'];
  65. echo "<br>";
  66. echo "<br>";
  67. }
  68.  
  69. $anymatches=mysql_num_rows($data);
  70. if ($anymatches == 0)
  71. {
  72. echo "Nic nie znaleziono<br><br>";
  73. }
  74.  
  75. echo "<b>Szukano:</b> " .$find;
  76. }
  77. ?>
  78. </body>
  79. </html>


Nie wiem dlaczego ale nie wyswietla on wynikow wyszukiwania. Czy ktos moglby mi pomoc?
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 20.08.2025 - 07:37