Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Content-Type: application/json; charset=UTF-8");
- $host = "localhost:3306";
- $username = "root";
- $password = "123";
- $dbname = "maordb";
- $obj = filter_input(INPUT_POST,'params');
- $array = json_decode($obj); // decode JSON to associative array
- $id = $array->id;
- $name = $array->name;
- $minimum = $array->minimum;
- $address = $array->address;
- $phonenumber = $array->phonenumber;
- $menus = $array->menus;
- $conn = mysqli_connect($host, $username, $password ,$dbname) or die("error connect to SQL: ".mysqli_connect_error());
- $sql = "INSERT INTO businesses ( businessId, name, minimum,address,phonenumber,menus) VALUES ('234234', 'מאור', '40', 'מאור', '65555555', 'toast')";
- if (mysqli_query($conn, $sql)) {
- echo "New record created successfully";
- } else {
- echo "Error: " . $sql . "<br>" . mysqli_error($conn);
- }
- mysqli_close($conn);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement