Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Emoty
ferr
post
Post #1





Grupa: Zarejestrowani
Postów: 122
Pomógł: 3
Dołączył: 18.12.2004

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


  1. <?php
  2. $query = &#092;"SELECT * FROM newsy ORDER BY 'id' DESC LIMIT 5\" ;
  3. $qresult = mysql_query($query);
  4.  
  5. if (mysql_num_rows($qresult) > 0) {
  6.  
  7. $query7 = &#092;"SELECT * FROM emots\";
  8. $result7 = mysql_query($query7);
  9. while ($row7 = mysql_fetch_array($result7))
  10. {
  11. $emoty = array(&#092;"\".$row7[\"emot1\"].\"\" => \"<img src='http://xxx/emots/\".$row7[\"emot2\"].\"'>\" );
  12. }
  13.  
  14.  
  15.  
  16. while ($row = mysql_fetch_array($qresult)) {
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24. if ($_SESSION[&#092;"emots\"]==\"1\")
  25. {
  26.  
  27.  
  28.  $tresc = str_replace($emoty, $emoty, $row[&#092;"tresc\"]);
  29.  
  30. }
  31.  
  32. else {
  33. $tresc = $row[&#092;"tresc\"];
  34. }
  35.  
  36.  
  37. list($ile)=mysql_fetch_row(mysql_db_query('xxx',&#092;"SELECT count(*) FROM kom_news WHERE news LIKE \".$row['id'].\"\"));
  38. echo &#092;"<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" class=g7><tr bgcolor=\"#384B5A\"><td>\".$row[\"tytul\"].\"</td></tr></table>
  39. <table width=&#092;"100%\" cellspacing=\"0\" cellpadding=\"2\" class=g4><tr bgcolor=\"#334B5E\"><td><div align=justify>\".$tresc.\"<p align=right><a href=index.php?co=news&id=\".$row[\"id\"].\" class=link1>skomentuj ($ile)</a></p></td></tr></table><br>\";
  40. } }
  41.  
  42. ?>


w bazie w polu emot1 jest znak do zastapienia a w polu emot2 adres obrazka ktory ma zastapic ten znak. Jak wiec zastapic wszystkie emoty w newsach?

Ten post edytował ferr 2.02.2005, 19:47:03
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
ferr
post
Post #2





Grupa: Zarejestrowani
Postów: 122
Pomógł: 3
Dołączył: 18.12.2004

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


  1. <?php
  2. $query7 = &#092;"SELECT * FROM emots\";
  3. $result7 = mysql_query($query7);
  4. while ($row7 = mysql_fetch_array($result7))
  5. {
  6. $emoty = array(&#092;"\".$row7[\"emot1\"].\"\" => \"<img src='http://xxx/emots/\".$row7[\"emot2\"].\"'>\" );
  7. }
  8.  
  9. ?>


podobne rozwiazanie wlasnie stosowalem, nie dalo jednak rezultatu, bo jak powiedzialem, zastepywalo tylko jedna emote. Po szczegolowej analizie zrozumialem ze powyzszy kod przypisuje tylko jedna wartosc do tablicy emoty. Jak rozwiazac ten problem?

sf: gratuluje mniemania o sobie...

Ten post edytował ferr 2.02.2005, 21:24: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: 16.10.2025 - 21:58