Vraag : PHP + MSSQL

Ik leer PHP en heb het opstelling, en gebruik lidstaten SQL 2005, zou ik de code in bijlage willen gebruiken, maar gebruik het die met lidstaten SQL verbinden, terwijl nog het verkrijgen van de zelfde output, kon u de noodzakelijke aanpassingen aan de code maken, zodat kan ik het gebruiken, die de manier ik langzaam kan beginnen om te begrijpen hoe PHP works.

thanks
" codeBody "
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
class AgentService { 
  var $username = „gebruiker“; 
  var $password = „gaat“ over; 
  var $server = „localhost“; 
  var $port = „1433“; 
  var $databasename = „testdrive_db“; 
  var $tablename = „werknemers“; 
  
  var $connection; 
  overheidsfunctie __construct () { 
    $this->connection = mysqli_connect ( 
                       $this->server,  
                       $this->username,  
                       $this->password, 
                       $this->databasename, 
                       $this->port 
                       ); 
    
    $this->throwExceptionOnError ($this->connection); 
  } 

  openbare functiegetEmployees () {
     $stmt = mysqli_prepare ($this->connection,
          „UITGEZOCHT
              employees.id,
              employees.firstname,
              employees.lastname,
              employees.title,
              employees.departmentid,
              employees.officephone,
              employees.cellphone,
              employees.email,
              employees.street,
              employees.city,
              employees.state,
              employees.zipcode,
              employees.office,
              employees.photofile
           VAN werknemers ");     
         
      $this->throwExceptionOnError ();

      mysqli_stmt_execute ($stmt);
      $this->throwExceptionOnError ();

      $rows = serie ();
      mysqli_stmt_bind_result ($stmt, $row->id, $row->firstname,
                    $row->lastname, $row->title, $row->departmentid,
                    $row->officephone, $row->cellphone, $row->email,  
                    $row->street, $row->city, $row->state, 
                    $row->zipcode, $row->office, $row->photofile);

      terwijl (mysqli_stmt_fetch ($stmt)) {
          $rows [] = $row;
          $row = nieuwe stdClass ();
          mysqli_stmt_bind_result ($stmt, $row->id, $row->firstname,
                    $row->lastname, $row->title, $row->departmentid,
                    $row->officephone, $row->cellphone, $row->email,  
                    $row->street, $row->city, $row->state, 
                    $row->zipcode, $row->office, $row->photofile);
      }

      mysqli_stmt_free_result ($stmt);
      mysqli_close ($this->connection);

      terugkeer $rows;
  }

Antwoord : PHP + MSSQL


Gebruik mssql_connect in plaats van mysqli_connect

http://www.php.net/manual/en/function.mssql-pconnect.php

Hoop dit helpt
Andere oplossingen  
 
programming4us programming4us