Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [mysql][php] Pytanie do mysql ? problem
kt1
post 5.04.2007, 09:46:09
Post #1





Grupa: Zarejestrowani
Postów: 131
Pomógł: 3
Dołączył: 9.02.2006
Skąd: moree.webd.pl

Ostrzeżenie: (10%)
X----


Witam
mam taki problem

  1. <?php
  2. function skr_dane($tekst, $il_znakow) 
  3. {
  4. if (strlen($tekst) > $il_znakow) 
  5. return substr($tekst, 0, strrpos(substr($tekst, 0, $il_znakow), " ")).' ...';
  6. else return $tekst;
  7. }
  8. ?> 
  9.  
  10.  
  11. <?php
  12. include("./ghe3dsjs/faofa43+4$.php");
  13. $id = (int)$_GET['id'];
  14. $sql = 'SELECT left(temat, 20) as tekst_skr FROM news';
  15.  
  16. $wynik = mysql_query($sql) or die(mysql_error());
  17.  
  18. while($w = mysql_fetch_assoc($wynik))
  19. {
  20. echo'<a href="index.php?blaba=777&id='.$w['id'].'">';
  21. echo skr_dane($w['tekst_skr'], 160);
  22. echo "</a><br>";
  23. }
  24.  
  25. ?>


mam takie kod on skraca tekst ... znalazłem na necie
i mam taki problem chcę pobrać id ale nie wiem jak
jak dodam
  1. <?php
  2. $sql = 'SELECT left(temat, 20) as tekst_skr FROM news WHERE id = '.$id.';
  3. ?>

to mam błąd może coś poradzicie ?

Ten post edytował kt1 5.04.2007, 09:47:22


--------------------
Jeśli masz jakieś fajne tutki albo coś inne związane z php mysql AJAX to wejdź
tu WEJDZ TU I DODAJ !!! :)
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 Wersja Lo-Fi Aktualny czas: 18.07.2025 - 04:18