Visual Studio code how to integrate support from PHP Srv driver
Asked Answered
O

1

5

I don't know if this is the right question but i'm working with MSSQL and PHP, and just installed the driver for PHP SqlSrv.

(You need to add an extension from Microsoft to work with MsSql because PHP don't support mssql_connect anymore)

But now i'm not sure how to add support for that driver in visual studio code, where it says i'm using a undefined function.

Is there some way to integrate the two or do i just need to be content that it works?

$serverName = "serverName\\sqlexpress"; //serverName\instanceName
$connectionInfo = array( "Database"=>"dbName", "UID"=>"userName", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn ) {
     echo "Connection established.<br />";
}else{
     echo "Connection could not be established.<br />";
     die( print_r( sqlsrv_errors(), true));
}
?>

Image that shows error

I use:

Windows 10, PHP 7.2.1.1, Laragon, php_pdo_sqlsrv-5.8.1-7.2-ts-vc15-x64, php_sqlsrv-5.8.1-7.2-ts-vc15-x64.

Oilcup answered 29/4, 2020 at 9:10 Comment(0)
O
20

I found a solution to stop my problem where it shows it didn't know the function

Go to setting Type: "@ext:bmewburn.vscode-intelephense-client"

Under Intelephense: Stubs

Add item: sqlsrv and pdo_sqlsrv

Oilcup answered 29/4, 2020 at 11:10 Comment(2)
thank you so much, after i install PHP IntelliSense and i do as you tell, it's work nice.Rudd
pdo_sqlsrv Does not appear in my list. Anything that can be done? Thank you so much.Attributive

© 2022 - 2024 — McMap. All rights reserved.