let [weatherData, setWeatherData] = useState({})
let fetchWeatherData = async() => {
let url = `https://api.openweathermap.org/data/2.5/forecast?q=Chicago&APPID=${process.env.APIKey}&cnt=5`
let response = await fetch(url);
let data = await response.json()
await setWeatherData(data)
}
useEffect(()=>{
fetchWeatherData()
}, [])
$connection = mysqli_connect(host: 'localhost', user: 'root', password: 'root');
$select_db = mysqli_select_db(link: $connection, dbname: 'practice');
$connection = mysqli_connect('localhost', 'root', 'root');
$select_db = mysqli_select_db($connection, 'practice');
php_flag display_errors on
$CONNECT = mysqi_connect('localhost' ,'u8310614_*****', '******' ,'u8310614_****');
if (!$CONNECT)
echo "Код ошибки errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Текст ошибки error: " . mysqli_connect_error() . PHP_EOL;
exit;
}
<?php
$out[] = json_decode(file_get_contents('php://input'));
$out[] = 100;
$out[] = $_POST;
echo json_encode($out);
?>
window.location.href="https://habr.com"