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
Wampir
post
Post #2





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

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


  1. array(10) { [0]=> string(2) "16" ["id"]=> string(2) "16" [1]=> string(1) "2" ["id_user"]=> string(1) "2" [2]=> string(6) "Samiec" ["pet_type"]=> string(6) "Samiec" [3]=> string(5) "Jacob" ["pet_name"]=> string(5) "Jacob" [4]=> string(1) "0" ["level"]=> string(1) "0" }


Po dodaniu var'a.

Ten post edytował Wampir 29.02.2012, 18:16:01
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: 4.10.2025 - 19:27