Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP] Profil użytkownika
Deotho
post
Post #1





Grupa: Zarejestrowani
Postów: 79
Pomógł: 0
Dołączył: 2.05.2012
Skąd: Hogwart

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


Witam!
Mam mały problem z działaniem kodu odsyłacza do profilu.

profile.php
  1. <?php
  2. include('config/db.php');
  3. include('templates/header.php');
  4. ?>
  5.  
  6. <?php if (!isset($_SESSION['login'])) { echo '<center>Aby zobaczyć profil użytkownika zaloguj się.</center>'; } else {?>
  7.  
  8. <?php
  9. $id = $_GET['id'];
  10.  
  11. if(is_numeric($id)) {
  12.  
  13. $query = mysql_query("SELECT * FROM users WHERE id = '$id'");
  14. $user = mysql_fetch_array($query);
  15.  
  16. echo 'Profil użytkownika '.$user['login'];
  17.  
  18. }
  19.  
  20. } ?>
  21.  
  22. <?php include('templates/footer.php'); ?>


header.php
  1. <?php if (!isset($_SESSION['login'])) { echo ''; } else {?>
  2. <li><a href="profile.php?id=$id;">Profil</a></li>
  3. <?php } ?>


Zamiast $id; powinnien być ID użytkownika. 1, 2, lub 8.

(IMG:style_emoticons/default/questionmark.gif)
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: 26.09.2025 - 13:48