Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- /usr/local/etc/odbc.ini
- --
- [MSSQLServer]
- Driver = SQL Server Native Client 11.0
- Description = Sample Database
- Trace = Yes
- Server =
- Port = 1433
- Database =
- */
- /* Connect using Windows Authentication. */
- $conn = odbc_connect("MSSQLServer", $connectionOptions["UID"], $connectionOptions["PWD"]);
- if(!$conn){
- echo "Sorry, not available MSSQL server.";
- exit();
- }
- else{
- // удалить старые данные
- $sql = "DELETE FROM ".COption::GetOptionString('studiobit.alliance', 'table_omni')." WHERE SystemAlias LIKE '%CRM%'";
- if(!odbc_exec($conn, $sql)){
- p2f($sql.": Query failed " .odbc_error());
- }
- // добавлить новые данные
- foreach($result as $key=>$arItem){
- $sql = "INSERT INTO ".COption::GetOptionString('studiobit.alliance', 'table_omni')." (".implode(', ', $keyTable).") values (".str_replace('"', "'", "\"".implode('", "', $arItem)."\"").")";
- $res = odbc_exec($conn, $sql);
- if (!$res){
- p2f($sql." | Query failed " .odbc_error());
- }else {
- $i++;
- }
- }
- }
- odbc_close($conn);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement