Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Database - problem
Forum PHP.pl > Forum > Przedszkole
Tygrys22
  1. <?php
  2. include (&#092;"constants.php\");
  3. class MySQLDB
  4. {
  5. var $connection; //The MySQL database connection
  6. var $num_active_users; //Number of active users viewing site
  7. var $num_active_guests; //Number of active guests viewing site
  8. var $num_members; //Number of signed-up users
  9. /* Note: call getNumMembers() to access $num_members! */
  10. /* Class constructor */
  11. function MySQLDB()
  12. {
  13. /* Make connection to database */
  14. $this->connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error());
  15. mysql_select_db(DB_NAME, $this->connection) or die(mysql_error());
  16. /**
  17.  * Only query database to find out number of members
  18.  * when getNumMembers() is called for the first time,
  19.  * until then, default value set.
  20.  */
  21. $this->num_members = -1;
  22. if (TRACK_VISITORS)
  23. {
  24. /* Calculate number of users at site */
  25. $this->calcNumActiveUsers();
  26. /* Calculate number of guests at site */
  27. $this->calcNumActiveGuests();
  28. }
  29. }
  30. /**
  31.  * confirmUserPass - Checks whether or not the given
  32.  * username is in the database, if so it checks if the
  33.  * given password is the same password in the database
  34.  * for that user. If the user doesn't exist or if the
  35.  * passwords don't match up, it returns an error code
  36.  * (1 or 2). On success it returns 0.
  37.  */
  38. function confirmUserPass($username, $password)
  39. {
  40. /* Add slashes if necessary (for query) */
  41. {
  42. $username = addslashes($username);
  43. ?>





TO jest jakas 1/3 czesc tego pliku co z nim jets nie tak albo jka go uzupelnic.

Taki komunikat wysakakuje mi po wgraniu wszytskich plikow na sewer

Warning
: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in /home/a8421709/public_html/includes/database.php on line 14

[/size][/font][/url]
Access denied for user 'roohttp://forum.php.pl/index.php?act=post&do=reply_post&f=27&t=98847
Reply to this topict'@'localhost' (using password: YES)
Heweliusz
Błąd oznacza, że podajesz złe parametry połączanie z bazą.
Pokaż kod, w którym wykorzystujesz ową klasę.
nevt
no dobrze - pokazałeś dwa skrypty...

ale gdzie jest probem?
musisz go opisać - wróżek na forum nie ma ....
Tygrys22
no własnie mam problem w ktorym miejscu mam wpisac dane potrzebne do połączenia z bazą o ile taka potrzeba istnieje. w problemie pokazało mi jedynie problem z tym plikiem dlatego tez ten umiesciłem i sadze ze to wlasnie w nim trzeba wpisac dane potrzebne do polczenia z baza.
phpion
Przejrzyj zawartość pliku constants.php - zakładam, że to właśnie w nim będą zapisane dane odpowiedzialne m.in. za połączenie z bazą danych. Musisz je zmienić na właściwe.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.