我的数据库位于SSMS中,我正在使用自定义php来检索数据,我已建立连接并执行查询,这给了我结果,但现在我想在执行之前打印/回显查询
我尝试了last_query()函数,但对我不起作用 我已经搜索过,但是结果是针对不同的数据库的 我的查询是由循环中的变量准备的
这是我的联系
$ServerName='DESKTOP-HCLLKV5';
$ConnectionInfo=array("Database"=>"SalesCampaign2019_1H" ,"CharacterSet"=>"UTF-8");
$Conn_sis=sqlsrv_connect($ServerName,$ConnectionInfo);
if($Conn_sis)
{
if(($DistinctCompany=sqlsrv_query($Conn_sis,
"SELECT dbo.WalkerItContacts.ConcatKey ,
dbo.WalkerItContacts.CompanyName,
dbo.WalkerItContacts.EmployeeCity,
dbo.WalkerItContacts.EmployeeAddress1
FROM dbo.WalkerItContacts
GROUP BY dbo.WalkerItContacts.ConcatKey,
dbo.WalkerItContacts.CompanyName,
dbo.WalkerItContacts.EmployeeCity,
dbo.WalkerItContacts.EmployeeAddress1
HAVING count(distinct dbo.WalkerItContacts.CompanyName) = 1
order by dbo.WalkerItContacts.CompanyName")) !== false)
{
print_r(last_query());
// here i want to check my query
exit("first");
while($DistinctCompany_result = sqlsrv_fetch_object( $DistinctCompany ))
{
这是我的第一个查询,同一文件还有更多查询