Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Błąd przy łączeniu z bazą mysql
alberthus
post
Post #1





Grupa: Zarejestrowani
Postów: 31
Pomógł: 0
Dołączył: 16.01.2014

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


Witam
Mam funkcjię łączącą z bazą danych ale z tego co wyczytałem jest bardzo stara bo zwraca taki błąd:

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\wamp\www\...

Czy mógłby ktoś pomóc przekształcić tą funkcję na bardziej "współczesną"?

  1. public function connect(){
  2. try{
  3. $this->dbLink = mysql_connect($this->host, $this->user, $this->password, $this->database);
  4.  
  5. if (!$this->dbLink){
  6. throw new Exception ("ERROR");
  7. }
  8. }
  9. catch (Exception $e){
  10. echo $e->getMessage();
  11. exit();
  12. }
  13. return $this->dbLink;
  14. }
Go to the top of the page
+Quote Post

Posty w temacie


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 Aktualny czas: 21.08.2025 - 15:02