Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [MySQL][PHP]Wyciąganie danych z bazy.
Croos22
post 19.10.2010, 21:48:29
Post #1





Grupa: Zarejestrowani
Postów: 316
Pomógł: 4
Dołączył: 22.03.2010

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


Witam.

Mam problem z tym kodem:

  1. <?php
  2. include ('includes/config_includes.php');
  3. $query = mysql_query("SELECT * FROM `users` WHERE user_id='{$_GET['user_id']}'");
  4. if($dane=mysql_fetch_array($query))
  5. {
  6. echo $dane['user_id'];
  7.  
  8. }
  9.  
  10. ?>


Nie ma błędów lecz nie wyświetla żadnych danych z bazy. Oto tabela:

  1. CREATE TABLE `users` (
  2. `user_id` tinyint(10) unsigned NOT NULL auto_increment,
  3. `user_name` varchar(13) collate latin1_general_cs NOT NULL,
  4. `user_password` varchar(40) collate latin1_general_cs NOT NULL,
  5. `user_password_short` varchar(17) collate latin1_general_cs NOT NULL,
  6. `user_email` text collate latin1_general_cs NOT NULL,
  7. PRIMARY KEY (`user_id`)
  8. ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs AUTO_INCREMENT=3;


Go to the top of the page
+Quote Post
Wicepsik
post 19.10.2010, 21:56:34
Post #2





Grupa: Zarejestrowani
Postów: 1 575
Pomógł: 299
Dołączył: 26.03.2009

Ostrzeżenie: (20%)
X----


mysql_fetch_array - zobacz w przykładach jak wyświetlić rekordy za pomocą pętli while


--------------------
Go to the top of the page
+Quote Post
Croos22
post 19.10.2010, 22:00:59
Post #3





Grupa: Zarejestrowani
Postów: 316
Pomógł: 4
Dołączył: 22.03.2010

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


  1. while($dane=mysql_fetch_array($query))
?
Go to the top of the page
+Quote Post
Otto
post 19.10.2010, 22:08:42
Post #4





Grupa: Zarejestrowani
Postów: 144
Pomógł: 7
Dołączył: 22.03.2010

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


  1. <?php
  2. include ('includes/config_includes.php');
  3. $query = mysql_query("SELECT * FROM `users` WHERE user_id='{$_GET['user_id']}'");
  4. while ($dane = mysql_fetch_array($query)) {
  5. echo $dane['user_id'];
  6. }
  7.  
  8. ?>


Ten post edytował Otto 19.10.2010, 22:09:03
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 6.07.2025 - 21:49