Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> dodawanie do mysql
cholew
post 10.06.2007, 12:54:58
Post #1





Grupa: Zarejestrowani
Postów: 64
Pomógł: 0
Dołączył: 5.01.2007

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


Co w tym kodzie jest zle ze mi nie chce dodawac do bazy? smile.gif

  1. <?php
  2. ...
  3. if (!$error)
  4. {  
  5. $res=mysql_query('insert into `fbw_useradmin` (`login`, `pass`, `email`, `activate_code`, `permissions`) values ('' . $_POST['login'] . '', '' . md5($md5_prefix . $_POST['pass']) . '' , '' . mysql_value($_POST['email']) . '', '' . $activate_code . '', '1');');
  6. $row=mysql_fetch_row($res);
  7. if (!$row)
  8.  {
  9. $error['misc'] = 'Nie mozna dodacďż˝konta do bazy danych. Sprobuj ponownie lub skontaktuj sieďż˝z 
    administratorem.'
    ;
  10. echo $error['misc'];
  11.  }
  12. else
  13. $registered=true;
  14. }
  15. ...
  16. ?>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 8)
SongoQ
post 10.06.2007, 12:59:34
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 923
Pomógł: 9
Dołączył: 25.10.2004
Skąd: Rzeszów - studia / Warszawa - praca

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


Srednik w zapytaniu. Wyswietl jaki blad Ci wywala.


--------------------
Go to the top of the page
+Quote Post
cholew
post 10.06.2007, 13:10:58
Post #3





Grupa: Zarejestrowani
Postów: 64
Pomógł: 0
Dołączył: 5.01.2007

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


dodaje taki wpis:
  1. <?php
  2. if (!$res)
  3. ?>

i zaden blad sie nie wyswietla.
Go to the top of the page
+Quote Post
SongoQ
post 10.06.2007, 13:57:52
Post #4





Grupa: Przyjaciele php.pl
Postów: 2 923
Pomógł: 9
Dołączył: 25.10.2004
Skąd: Rzeszów - studia / Warszawa - praca

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


  1. <?php
  2. $res=mysql_query('insert into `fbw_useradmin` (`login`, `pass`, `email`, `activate_code`, `permissions`) values ('' . $_POST['login'] . '', '' . md5($md5_prefix . $_POST['pass']) . '' , '' . mysql_value($_POST['email']) . '', '' . $activate_code . '', '1');');
  3. $row=mysql_fetch_row($res);
  4. ?>

A to? Po co Ci fetch_row?


--------------------
Go to the top of the page
+Quote Post
cholew
post 10.06.2007, 14:09:04
Post #5





Grupa: Zarejestrowani
Postów: 64
Pomógł: 0
Dołączył: 5.01.2007

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


a w jaki sposob mam to zapisac do bazy?? smile.gif
Go to the top of the page
+Quote Post
Nightmare
post 10.06.2007, 15:00:56
Post #6





Grupa: Zarejestrowani
Postów: 45
Pomógł: 1
Dołączył: 21.05.2007

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


samo wywołanie inserta dodaje do bazy...
Spróbuj tak:
  1. <?php
  2. $res=mysql_query('insert into `fbw_useradmin` (`login`, `pass`, `email`, `activate_code`, `permissions`) values ('' . $_POST['login'] . '', '' . md5($md5_prefix . $_POST['pass']) . '' , '' . mysql_value($_POST['email']) . '', '' . $activate_code . '', '1');') or die(mysql_error());
  3. ?>

I powiedz jaki błąd ci wyrzuca

Ten post edytował Nightmare 10.06.2007, 15:02:22
Go to the top of the page
+Quote Post
SongoQ
post 10.06.2007, 15:03:14
Post #7





Grupa: Przyjaciele php.pl
Postów: 2 923
Pomógł: 9
Dołączył: 25.10.2004
Skąd: Rzeszów - studia / Warszawa - praca

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


mysql_query('zapytanie');

I wywal ten ; z zapytania.


--------------------
Go to the top of the page
+Quote Post
Glarden
post 10.06.2007, 17:01:33
Post #8





Grupa: Zarejestrowani
Postów: 153
Pomógł: 2
Dołączył: 28.05.2007
Skąd: Stamtąd

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


A mi się wydaje, że powinno być tak:
  1. <?php
  2. $res=mysql_query('insert into `fbw_useradmin` values (`login`, `pass`, `email`, `activate_code`, `permissions`) values ('' . $_POST['login'] . '', '' . md5($md5_prefix . $_POST['pass']) . '' , '' . mysql_value($_POST['email']) . '', '' . $activate_code . '', '1');') or die(mysql_error());
  3. ?>

Zapomniałeś o "values" w zapytaniu.


--------------------
Raz, dwa, trzy, baba Jaga patrzy!
http://trelemorele.cba.pl
Go to the top of the page
+Quote Post
Nightmare
post 10.06.2007, 17:58:26
Post #9





Grupa: Zarejestrowani
Postów: 45
Pomógł: 1
Dołączył: 21.05.2007

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


values jest dalej a to pierwsze to lista pól...

Ten post edytował Nightmare 10.06.2007, 17:58:35
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: 19.07.2025 - 08:32