Last active
August 29, 2015 13:58
-
-
Save leonguyen/9947275 to your computer and use it in GitHub Desktop.
sqlsrv_prepare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Select */ | |
| $tsql = "SELECT * FROM ACT_Currency_Exch_Rate_Tbl | |
| WHERE Currency_Code = ? | |
| AND Effective_Date_Time <= ? | |
| AND Expiry_Date_Time IS NULL"; | |
| $data = array(&$param['CURR_CODE'],date("m/d/Y")); | |
| $stmt = sqlsrv_prepare($conn, $tsql, $data); | |
| if(sqlsrv_execute($stmt) === false) die('ACT_Currency_Exch_Rate_Tbl_sel '.print_r(sqlsrv_errors(),true)); | |
| while($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) { | |
| $arIn['CURR_RATE'] = $row['Exchange_Rate']; | |
| break; | |
| } | |
| /* Insert */ | |
| $tsql = "INSERT INTO AM_Job_Master_Tbl ( | |
| [Job_Number] , | |
| [Master_Number] | |
| ) | |
| VALUES (?, ?)"; | |
| $data = array( | |
| &$arIn['Job_Number'], | |
| '' | |
| ); | |
| $stmt = sqlsrv_prepare($conn, $tsql, $data); | |
| if(sqlsrv_execute($stmt) === false) die('AM_Job_Master_Tbl_ins '.print_r(sqlsrv_errors(),true)); | |
| sqlsrv_free_stmt($stmt); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment