Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php]jak odebrac zmienn przesylana $_GET[php]
martino277
post
Post #1





Grupa: Zarejestrowani
Postów: 86
Pomógł: 0
Dołączył: 23.11.2006

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


czesc!mam pytanie wiem mniej wiecej co w trawie piszczy ale niedokonca niemoge odebrac tak jak trzeba zmiennej przesylanej w adresie przez GET

przesylam zmienna

strona.php?id=$id

a probuje ja odebrac za pomoca takiego kodu
  1. <?php
  2. include "connect.php";
  3.  
  4.  
  5. $id=$_GET['id'];
  6. $pyt=mysql_query("SELECT * FROM anonse WHERE id='$id'");
  7. if(!$pyt) {echo mysql_errno().": "; echo mysql_error()."<br>"; }
  8. if($row=mysql_fetch_array($pyt))
  9. {
  10. $mail=$row['mail'];
  11. $tel=$row['tel'];
  12. }
  13.  
  14. echo("<center><span class=normal>Adres e-mail: </span><a href=mailto:$mail class=linki>$mail</a></center><br>");
  15.  
  16. if($tel!="")
  17. echo("<center><span class=normal>Telefon: <b>$tel</b></span></center>");
  18. ?>

ale to cos jest chyba zle bo powinno pokazywac adres email i telefon a pokazuje tylko adres email: i wiecej nic prosze o jakas podpowiedz pozdrawiam z gory dziekuje

Ten post edytował martino277 10.10.2007, 10:37:49
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
martino277
post
Post #2





Grupa: Zarejestrowani
Postów: 86
Pomógł: 0
Dołączył: 23.11.2006

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


dzieki za wyjsnienie panowie to sie pomylilem znaczy sie zaraz zmienie to dlatego mi nieodbieraznaczy sie jak zmienie post na get to powinno dzialac zaraz sprawdze

no dalem taki kod
  1. <?php
  2. include "connect.php";
  3. echo $_GET["id"];
  4. $pyt=mysql_query("SELECT * FROM anonse WHERE id=$id");
  5. if(!$pyt) {echo mysql_errno().": "; echo mysql_error()."<br>"; }
  6. if($row=mysql_fetch_array($pyt))
  7. {
  8. $mail=$row['mail'];
  9. $tel=$row['tel'];
  10. }
  11.  
  12. echo("<center><span class=normal>Adres e-mail: </span><a href=mailto:$mail class=linki>$mail</a></center><br>");
  13.  
  14. if($tel!="")
  15. echo("<center><span class=normal>Telefon: <b>$tel</b></span></center>");
  16. ?>

ale jest taki blad
1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

Adres e-mail:
czyli niewiem co jest? (IMG:http://forum.php.pl/style_emoticons/default/sciana.gif)

Ten post edytował martino277 10.10.2007, 10:53:59
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: 15.10.2025 - 19:46