Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][MySQL]System profili
Wampir
post
Post #1





Grupa: Zarejestrowani
Postów: 50
Pomógł: 0
Dołączył: 26.02.2012
Skąd: Wrocław

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


Witam!
Mam tabelę, a w niej kolumny takie jak:

id_user - id właściciela
pet_name - nazwa zwierzątka
pet_type - płeć
level - poziom

Chcę, aby wyświetlało mi to wszystko po wejściu w np. profil.php?id=2

Kod:
  1. <html>
  2. <head>
  3. <meta http-equiv="content-type" content="text/html; charset=utf-8" >
  4. <title> localhost.pl :: <?php echo $name; ?></title>
  5. <link rel="stylesheet" href="theme/style.css" type="text/css">
  6. <link rel="Shortcut icon" href="theme/favicon.png" />
  7. </head>
  8.  
  9. <?php
  10. require ("config/polacz.php");
  11.  
  12. $id = $_GET['id'];
  13. $name = $_GET['name'];
  14.  
  15. $sql = mysql_query("SELECT * FROM `adoptions` WHERE `pet_type`, `level`, `user` = '$pet_type', '$level', '$user'") or die('BŁĄD:'.mysql_error());
  16. while($row = mysql_fetch_array($sql)) {
  17. $name; <br>
  18. <b>Płeć:</b> '.$row['pet_type'].' <br>
  19. <b>Właściciel:</b> $id; <br>
  20. <b>Poziom:</b> '.$row['level'].' <br>
  21. ';
  22. }
  23.  
  24.  
  25. ?>


A, tutaj zwrócony błąd
Kod
BŁĄD:Something is wrong in your syntax obok ' `level`, `user` = '', '', ''' w linii 1
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Evinek
post
Post #2





Grupa: Zarejestrowani
Postów: 280
Pomógł: 46
Dołączył: 23.03.2010

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


Daj zamiast tego:
<b>Właściciel:</b> <a href="profil.php?id='.$row['user_id'].'" style="text-decoration: none;">test</a> <br>
to:
<b>Właściciel:</b> <a href="profil.php?id='.$row['id_user'].'" style="text-decoration: none;">test</a> <br>

Nawet nie znasz swojej struktury bazy danych...

@EDIT:
Ogólnie nie potrzebnie tak naprawdę dawałeś nam ten kod tylko sam powinieneś pomyśleć i tak zrobić.
MYŚL! Nie potrzebnie co chwile z takimi głupstwami idziesz na forum...

@EDIT2:
Sorki, jako user to miałeś inne. Wyżej poprawny kod.

Ten post edytował Evinek 29.02.2012, 18:20:35
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: 5.10.2025 - 15:45