Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> laczenie za pomoca php z mssql
john_doe
post
Post #1





Grupa: Zarejestrowani
Postów: 873
Pomógł: 25
Dołączył: 24.07.2005

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


próbuje łączyc sie z mssql`em w taki oto sposob

  1. <?php
  2. $user = 'user'; 
  3. $pass = 'pass';
  4. try {
  5.  $dbh = new PDO('mssql:host=baza;dbname=dbname', $user, $pass);
  6.  print '<table border = "1" align="center" ><tr><td>Lp</td><td>Nazwa</td></tr>';
  7.  foreach ($dbh->query('SELECT * from tabela') as $row) 
  8.  {
  9.  print '<tr><td>';
  10.  print $row[0];
  11.  print '</td><td>';
  12.  print $row[1];
  13.  print '</td>';
  14.  }
  15.  print '</table>';
  16.  $dbh = null;
  17. } catch (PDOException $e) {
  18.  print "Error!: " . $e->getMessage() . "<br/>";
  19.  die();
  20. }
  21. ?>


i dostaje blady typu
Error!: SQLSTATE[01002] Unable to connect: SQL Server is unavailable or does not exist. Access denied. (severity 9)

co moze byc nie tak?

pozdrawiam
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: 25.09.2025 - 03:13