I am using Sql server 2012 procedure to execute using php and the result should be store into table on sql server only. I am facing this issue, I can fetch the data from php code but when i insert that data into table only one value is inserted.I can see different values on my screen when i run php script.but back to data base only first value is inserted. I am not getting where i am going wrong. please help me with this. Thanks in advance.
while ($obj = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC ))
{
if($obj['Bank_Name']!= $obj['Bank_Name_old'])
{
$obj['company_code'];
$obj['Account_Code'];
$obj['Bank_Name'];
$obj['Bank_Name_old'];
$obj['field_name']='Bank Name';
if($obj['field_name']='Bank Name')
{
$old=$obj['Bank_Name_old'];
$new=$obj['Bank_Name'];
}
$query="insert into vns_db.dbo.client_details_log (company_code,client_id,field_name,original_value,new_value) values ('".$obj['company_code']."',
'".$obj['Account_Code']."','".$obj['field_name']."','$old','$new')".'<br>';
$res = sqlsrv_query($conn,$query);
echo $res;
echo $query;
}
this is php script output
