« Programmation PHP/Microsoft SQL Server » : différence entre les versions

Contenu supprimé Contenu ajouté
Aucun résumé des modifications
Ligne 8 :
== Connexion ==
=== Pilote 1.1 SQL Server pour PHP ===
Ce pilote fournit des fonctions d’interaction avec [[Microsoft SQL Server]]. Il peut s'utiliser avec les version de SQL Server postérieure à 2005<ref>http://msdn.microsoft.com/fr-fr/library/cc296152%28v=sql.90%29.aspx</ref>.
{{Principe
| contenu =
| contenu =<ref>http://msdn.microsoft.com/fr-fr/library/cc296152%28v=sql.90%29.aspx</ref>
<source lang="php">
$serverName = "(local)";
Ligne 22 :
}}
 
=== Alternative désuète ===
Les fonctions suivantes sont supprimées depuis PHP 7.0<ref>http://php.net/manual/fr/function.mssql-connect.php</ref> :
{{Principe
| contenu =<ref>http://www.php.net/manual/fr/function.mssql-select-db.php</ref>
Ligne 34 ⟶ 35 :
sqlsrv_close($connect);
?>
</source>
}}
 
=== Alternative Doctrine ===
Les bibliothèques Doctrine utilisent cette syntaxe<ref>http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html</ref> :
{{Principe
| contenu =
<source lang="php">
$config = new \Doctrine\DBAL\Configuration();
$connectionParams = array(
'driver' => 'pdo_sqlsrv',
'host' => $this->serverName,
'dbname' => $this->databaseName,
'user' => $this->userName,
'password' => $this->password,
);
$this->connection = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
$this->connection->query($query);
$this->connection->close();
</source>
}}