Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [sql] zapytanie
Raffal
post
Post #1





Grupa: Zarejestrowani
Postów: 111
Pomógł: 0
Dołączył: 19.06.2006

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


nie moge sobie poradzic ze zlozeniem zapytania do pobierania danych zaleznych (where) od danych zawartych w innej tabeli pobralem obydwie i zlozylem tak ale cos jest nie tak


  1. $id_koment=mysql_query('select * from komentarze order by data_koment where id_news='".$w[0]") ;




Parse error: syntax error, unexpected '"' in
?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Raffal
post
Post #2





Grupa: Zarejestrowani
Postów: 111
Pomógł: 0
Dołączył: 19.06.2006

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


ok dzieki mam jeszcze jeden problem tzn chce stworzyc sobie system newsow z komentarzami i stworzylem cos takiego

  1. <?
  2. include "php/param.php";
  3. $id=mysql_query('select * from news') ;
  4. //echo (mysql_error);
  5. while ($w=mysql_fetch_row($id)){
  6.  echo ("<P class=TRESCNAGLOWEK>");
  7.  echo $w[1];
  8.  echo ("</P>");
  9.  echo ("<P class=TRESC>");
  10.  echo ("<img src=");
  11.  echo $w[3];
  12.  echo (">"); 
  13.  echo $w[2];
  14.  echo ("<br>");
  15.  echo("<font size=1 color=gray>");
  16.  echo $w[0];
  17.  
  18.  echo (" ");
  19.  echo $w[5];
  20.  echo (" ");
  21.  
  22.  echo $w[4];
  23.  echo ("</font>"); 
  24.  
  25.  echo "<br>";
  26. }
  27. $id2=mysql_query("select * from komentarze where id_news='".$nr."'") or die (mysql_error);
  28.  
  29. while ($v=mysql_fetch_row($id2)){
  30. echo "<table border=1><tr><td>";
  31. echo $v[2];
  32. echo "</td></tr>"; 
  33. echo "<tr><td>";
  34. echo $v[3];
  35. echo "</td></tr><tr><td>";
  36. echo $v[4];
  37. echo $v[5];
  38. echo "</td></tr></table>";
  39. }
  40.  
  41.  
  42. echo '<form method="post">';
  43. echo '<input type="text" name="autor"><br>';
  44. echo '<textarea name="tresc"></textarea>';
  45.  
  46.  $m=$_POST['tresc'];
  47.  $l=$_POST['autor'];
  48.  $k=date("Y-m-d H:i");
  49.  
  50.  $pytanie2="INSERT into komentarze values('','"$nr"','".$l."','".$k."','".$m."')"; 
  51.  mysql_query($pytanie2) or die (mysql_error);
  52.  
  53. echo '</form>';
  54.  
  55.  
  56. ?>


wyskakuje mi taki blad

Parse error: syntax error, unexpected T_VARIABLE in /home/accounts_r/raffal/public_html/php/system_news/load_news.php on line 50

a w tej lini jest wstawianie wartosci do bazy wiec nie wiem dlaczego to nie dziala ;/


ta tabela wyglada tak

id komentarza, id newsa, autor, data ,tresc

Ten post edytował Raffal 18.07.2007, 16:49:00
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: 8.10.2025 - 03:55