Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP]Przenoszenie bazy danych
marcin86s
post
Post #1





Grupa: Zarejestrowani
Postów: 58
Pomógł: 0
Dołączył: 29.11.2007
Skąd: City 17

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


  1. while($r = mysql_fetch_array($stara_users))
  2. {
  3. $id = $r['id'];
  4. $email = $r['email'];
  5. $clan = '';
  6. $username = $r['username'];
  7. $password = '';
  8. $oldpassword = $r['password'];
  9. $avatar = '';
  10. $logins = $r['visits'];
  11. $register_date = date("Y-m-d H:i:s", $r['registerdate']);
  12. $last_login = date("Y-m-d H:i:s", $r['lastlogin']);
  13. echo ':'.$email.'| '.$username.'| '.$oldpassword.'| '.$logins.'| '.$register_date.'| '.$last_login.'<br />';
  14.  
  15. $dodaj_nowa = mysql_query('INSERT INTO users (id, email, username, password, oldpassword, avatar, logins, register_date, last_login) VALUES ('.$id.', '.$email.', '.$clan.', '.$username.', '.$password.', '.$oldpassword.', '.$avatar.', '.$logins.', '.$register_date.', '.$last_login.')', Nowa());
  16. NowaClose();
  17. echo $username.'Dodawanie... <br />';
  18. }

  1. CREATE TABLE IF NOT EXISTS `users` (
  2. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  3. `email` varchar(254) NOT NULL,
  4. `clan` varchar(254) NOT NULL,
  5. `username` varchar(32) NOT NULL DEFAULT '',
  6. `password` varchar(64) NOT NULL,
  7. `oldpassword` varchar(64) NOT NULL,
  8. `avatar` varchar(255) NOT NULL,
  9. `logins` int(10) UNSIGNED NOT NULL DEFAULT '0',
  10. `register_date` datetime NOT NULL,
  11. `last_login` datetime NOT NULL,
  12. PRIMARY KEY (`id`),
  13. UNIQUE KEY `uniq_email` (`email`),
  14. UNIQUE KEY `uniq_username` (`username`)
  15. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

Wpisy pobiera prawidłowo, ale nie dodaje nowych do bazy danych, co jest nie tak?

Ten post edytował marcin86s 28.11.2011, 08:59:41
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Sephirus
post
Post #2





Grupa: Zarejestrowani
Postów: 1 527
Pomógł: 438
Dołączył: 28.06.2011
Skąd: Warszawa

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


Na Bank brakuje cudzysłowów przy wartościach tekstowych w zapytaniu (IMG:style_emoticons/default/smile.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: 2.10.2025 - 18:17