Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> prosta wyszukiwarka
dekoder
post
Post #1





Grupa: Zarejestrowani
Postów: 22
Pomógł: 0
Dołączył: 28.05.2007

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


Cześć jestem Franek (IMG:http://forum.php.pl/style_emoticons/default/biggrin.gif)

Wyszukiwarka miałaby szukać po tabeli i określonym polu fraze wybrana z listy select



cuś napisałem:

  1. <form action="search.php" method="post">
  2. <select name="impreza"><option value="impreza1">impreza 1</option><option value="impreza2">impreza 2</option></select><BR />
  3. <select name="miejsce"><option value="dyskoteka">dyskoteka</option><option value="pub">pub</option></select><BR />
  4. <select name="termin"><option value="06_07">VI 07</option><option value="07_07">VII 07</option></select><BR />
  5. <input type="submit" value="szukaj">
  6. </form>
  7.  
  8. <? if (!$impreza || !$miejsce || !$termin)
  9. {
  10. print "Wypelnij wszystkie pola";
  11. }
  12.  
  13. @ $db = mysql_pconnect("host", "user", "haslo");
  14. if (!$db)
  15. {
  16. print "blad w polaczeniu";
  17. }
  18.  
  19.  
  20. $query = " select * from jakastabela ".$impreza." and ".$miejsce." and ".$termin.";
  21. $result = mysql_query($query);
  22. $num_results = mysql_num_rows($result);
  23.  
  24. print "<p>Ilosc znalezionych fraz : " .$num_results."</p>";
  25. for ($i=0; $i <$num_results; $i++) {
  26. $row = mysql_fetch_array($result);
  27. print ($i+1).". ";
  28. print stripslashes($row["header"]);
  29. print ", naglowek: ";
  30. print stripslashes($row["header2"]);
  31. print " tresc ,data:";
  32. print stripslashes($row["termin"]);
  33. print "<BR />";
  34. }
  35. ?>


wyskakuje Parse error: parse error, unexpected '\"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /www/search.php on line 27

helpy

Ten post edytował dekoder 1.06.2007, 08:45:41
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
dekoder
post
Post #2





Grupa: Zarejestrowani
Postów: 22
Pomógł: 0
Dołączył: 28.05.2007

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


Witam.
Dzięki za odzew.

skasowałem bo troche niewyraźnie było napisane:
chodzi o to że szukana fraza ma zawierać polskie znaki - więc w value nie będę mógł umieścić tego słowa.
Więc chciałbym je podmienić już w skrypcie wyszukiwarki na to odpowiednie.

  1. <form action="search.php" method="post">
  2. <select name="impreza"><option value="impreza1">impreza 1</option><option value="impreza2">impreza 2</option></select><BR />
  3. <select name="miejsce"><option value="dyskoteka">dyskoteka</option><option value="pub">pub</option></select><BR />
  4. <select name="termin"><option value="06_07">VI 07</option><option value="07_07">VII 07</option></select><BR />
  5. <input type="submit" value="szukaj">
  6. </form>


  1. <IF (!$_POST['impreza'] || !$_POST['miejsce'] || !$_POST['termin'])
  2.  
  3. {
  4. print "Wypelnij wszystkie pola";
  5. exit;
  6. }
  7.  
  8. $impreza = addslashes($impreza);
  9. $miejsce = addslashes($miejsce);
  10. $termin = addslashes($termin);
  11.  
  12.  
  13. @ $db = mysql_pconnect("xxx", "xxx", "xxx");
  14. IF (!$db)
  15. {
  16. print "blad w polaczeniu";
  17. exit;
  18. }
  19.  
  20. mysql_select_db("navigatort_db1");
  21.  
  22.  
  23. $query = 'select * from sys_grouptextentry WHERE header="'.$impreza.'"; and content="'.$miejsce.'" and header2="'.$termin.'" ';
  24. $result = mysql_query($query);
  25. $num_results = mysql_num_rows($result);
  26.  
  27. print " .$num_results. ";
  28. FOR ($i=0; $i <$num_results; $i++) {
  29. $row = mysql_fetch_array($result);
  30. print ($i+1).". ";
  31. print stripslashes($row["header"]);
  32. print ", naglowek: ";
  33. print stripslashes($row["header2"]);
  34. print " tresc ,data:";
  35. print stripslashes($row["date"]);
  36. print "<BR />";
  37. }
  38. ?>


coś nie działa ...
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /www/search.php on line 25

Ten post edytował dekoder 3.06.2007, 14:05:16
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: 3.10.2025 - 10:51