I am new in php and I have a problem a push from your would be no refusal :p, my problem is when I execute the query in sql server its works normaly but when I execute its with php does not work empty result . thanks to helping me
here my code:
Code: Select all
$sql = "
select t.Tan, SUM(s.TOP) as Top
into #TempEnj
from [Proses].[dbo].[CD_Dok] d
inner join [Proses].[dbo].[CD_Sar] s on(s.DOID = d.ID)
inner join [Proses].[dbo].[CT_Sa] t on (s.TANID= t.ID)
where d.date ='2017-10-05'
group by T.Tan
insert into #TempEnj values ('Enerji', (select sum(Enj) from [Proses].[dbo].[CD_Dok] where date ='2017-10-05'))
insert into #TempEnj values ('Sure', (select sum(Sure) from [Proses].[dbo].[CD_Dok] where date ='2017-10-05'))
select * from #TempEnj ";
$stmt5 sqlsrv_query( $conn, $sql );
if( $stmt == false ) {
if( ($errors = sqlsrv_errors() ) != null) {
foreach( $errors as $error ) {
echo "SQLSTATE: ".$error[ 'SQLSTATE']."<br />";
echo "code: ".$error[ 'code']."<br />";
echo "message: ".$error[ 'message']."<br />";
}
}
}
$tab[]= array();
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
$tab[] = $row;
}
var_dump($tab);