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%)
-----


źle .

<form action="search.php" method="post">
<select name="impreza">
<option value="rajd">rajd samochodowy-dział1</option>
<option value="impreza2">impreza 2</option></select><BR />
<input type="submit" value="szukaj">
</form>


tibod,nospor lub ktoś inny:

musi szukać w KOLUMNIE po id artykułu, id są niestety stałe

np. w kolumnie article_id są różne pola o innych id a chciałbym wybrać tylko te, które wskazał użytkownik w formularzu - a żeby widok rajd samochodowy w formularzu się nie zmienił.
czy ukryta opcja tu pomoże? jak jej używać

pierwszy select wybiera id, ale w nazwie nie pokazuje ID tylko rajd samochodowy
drugi select to już szukane , zadeklarowane słowo

problem jest również z wyświetlaniem, bo wyświetla wszystkie wyniki...


dużo pisania, mało roboty..

  1. <? IF (!$_POST['impreza'] || !$_POST['miejsce'] || !$_POST['termin'])
  2.  
  3. {
  4. print "Wypelnij wszystkie pola";
  5. exit;
  6. }
  7.  
  8. @ $db = mysql_pconnect("xxx", "xxx", "xxx");
  9. IF (!$db)
  10. {
  11. print "blad w polaczeniu";
  12. exit;
  13. }
  14.  
  15. mysql_select_db("navigatort_db1");
  16.  
  17.  
  18. $query = 'select * from sys_grouptextentry WHERE header=" '.$impreza.' " like " ' .$impreza. '" ';
  19. $result = mysql_query($query) OR die('zapytanie: '.$query.'----blad: '.mysql_error());
  20. $num_results = mysql_num_rows($result);
  21.  
  22. print "Ilosc wynikow : $num_results ";
  23. FOR ($i=0; $i <$num_results; $i++) {
  24. $row = mysql_fetch_array($result);
  25. print ($i+1).". ";
  26. echo "<table border='0' width='555' id='oferta'>";
  27. echo "<tr>";
  28. echo "<td colspan='2' id='oferta'><center>";
  29. echo stripslashes($row["header"]);
  30. echo "</center></td></tr>";
  31. echo "<tr>";
  32. echo "<td width='450' id='oferta'><p>";
  33. echo stripslashes($row["content"]);
  34. echo "</p></td><td width='105' id='oferta'><center>";
  35. echo stripslashes($row["header2"]);
  36. echo "</center></td></tr>";
  37. echo "<tr>";
  38. echo "<td colspan=2 id='oferta'><center>czytaj wiecej</center></td></tr>";
  39. echo "<tr>";
  40. echo "</table>";
  41. }
  42. ?>
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 - 22:33