21 lines
380 B
PHP
21 lines
380 B
PHP
<?php
|
|
|
|
$dbhost = "172.18.0.3";
|
|
$dbuser = "root";
|
|
$dbpass = "secret";
|
|
$dbname = "db";
|
|
|
|
$con = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
|
|
|
|
$rawData = file_get_contents('php://input');
|
|
|
|
$data = json_decode($rawData, true);
|
|
|
|
$kw = "INSERT INTO paliwa (nazwa, cena) VALUES ('{$data['nazwa']}', {$data['cena']} );";
|
|
|
|
echo json_encode($kw);
|
|
|
|
$ans = mysqli_query($con, $kw);
|
|
|
|
?>
|