SELECT * INTO #temp_MarkaAutos_1644569816 FROM MarkaAutos WHERE 1<>1
UNION ALL
SELECT * FROM MarkaAutos where 1 = 0;
SET IDENTITY_INSERT MarkaAutos ON; --разрешаем вставку рк
INSERT INTO #temp_MarkaAutos_1644569816 (id,name,icon,slug,rusName) VALUES ('1','Acura','.jpg','acura','Акура');
MERGE INTO MarkaAutos AS t
USING #temp_MarkaAutos_1644569816 AS t2
ON 1=2
WHEN MATCHED THEN
UPDATE SET name = t2.name,icon = t2.icon,slug = t2.slug,rusName = t2.rusName
WHEN NOT MATCHED THEN
INSERT (id,name,icon,slug,rusName) VALUES (t2.id,t2.name,t2.icon,t2.slug,t2.rusName);
SET IDENTITY_INSERT MarkaAutos OFF; --отключаем вставку рк
DROP TABLE #temp_MarkaAutos_1644569816; --удаляем временную таблицу
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://api.direct.yandex.ru/live/v4/json/');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,'{
"method": "AccountManagement",
"token": "AQAAAAAW-*******************************",
"param": {"SelectionCriteria": {}, "Action": "Get"}}'); //Post Fields
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = [
'POST /json/v5/ads/ HTTP/1.1',
'Host: api.direct.yandex.com',
'Authorization: Bearer AQAAAAAW-**********************************',
'Accept-Language: ru',
'Client-Login: *************@yandex.ru',
'Content-Type: application/json; charset=utf-8',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$server_output = curl_exec ($ch);
curl_close ($ch);
$balance_direct_miramall = json_decode($server_output,true);
<div class="calculator_table">
<select id="calc-month">
<option value="0">January</option>
<option value="1">February</option>
<option value="2">March</option>
<option value="3">April</option>
<option value="4">May</option>
<option value="5">June</option>
<option value="6">July</option>
<option value="7">August</option>
<option value="8">September</option>
<option value="9">October</option>
<option value="10">November</option>
<option value="11">December</option>
</select>
<select id="calc-day"></select>
<select id="calc-year"></select>
<p align="center"><button onclick="calculate();return false;">Calculate</button></p>
<div id="results"></div>
</div>
<script>
window.onload = function()
{
var npw = new Date();
var g = npw.getFullYear();
var m = npw.getMonth();
var da = npw.getDate();
for (var y = 2014; y < 2050; y++ )
{
document.getElementById('calc-year').innerHTML += '<option value="'+y+'">' + y +'</option>';
}
for (var d = 1; d <= 31; d++ )
{
document.getElementById('calc-day').innerHTML += '<option value="'+d+'">' + d +'</option>';
}
document.getElementById('calc-year').value=g;
document.getElementById('calc-month').value=m;
document.getElementById('calc-day').value=da;
}
function calculate()
{
var monthNames = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
var day = Number(document.getElementById('calc-day').value);
var month = Number(document.getElementById('calc-month').value);
var year = Number(document.getElementById('calc-year').value);
var nextday = day + 280;
var initial = new Date(Date.UTC( year, month, day, 0, 0, 0));
var predicted = new Date(Date.UTC( year, month, nextday, 0, 0, 0));
var now = new Date();
var formated = monthNames[predicted.getMonth()] + ' ' + predicted.getDate() + ', ' + predicted.getFullYear();
var leftDays = ( predicted.getTime() - now.getTime() ) / (24*3600*1000);
var currentWeeks = (now.getTime() - initial.getTime()) / (7*24*3600*1000)
document.getElementById('results').innerHTML = '<p>Your estimated due date is ' + formated + '</p><p>Days left to your date: '+ parseInt(leftDays) +'</p><p>Weeks of pregnancy: '+ Math.round(currentWeeks) +'</p>';
}
</script>