PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE list_orders ( id int(10) PRIMARY KEY, event_id int(11), event_date varchar(10), ticket_adult_price int(11), ticket_adult_quantity int(11), ticket_kid_price int(11), ticket_kid_quantity int(11), barcode varchar(120), equal_price int(11), created datetime );
Copy Clear
Copy Format Clear
<?php use Carbon\Carbon; $now = Carbon::now()->format('d/m/Y'); printf("Today is %s\nCurrent PHP version: %s \n\n", $now, phpversion()); $query = "SELECT VERSION() as version;"; // get DB version using PDO $stmt = $pdo->prepare($query); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); printf('DB version (PDO): %s ' . PHP_EOL, $row['version']); // Run query using mysqli $result = $mysqli->query($query); $version = $result->fetch_object(); printf('DB version (mysqli): %s ' . PHP_EOL, $version->version); // Select using Laravel $version = $db::select($query); printf('DB version (Laravel Query Builder): %s ' . PHP_EOL, $version[0]->version); // функция, которая будет добавлять заказы в эту таблицу $sql = "CREATE TABLE list_orders ( id int(10) PRIMARY KEY, event_id int(11), event_date varchar(10), ticket_adult_price int(11), ticket_adult_quantity int(11), ticket_kid_price int(11), ticket_kid_quantity int(11), barcode varchar(120), equal_price int(11), created datetime )"; //$result = $mysqli->query($sql); function addOrders($event_id, $event_date, $ticket_adult_price, $ticket_adult_quantity, $ticket_kid_price, $ticket_kid_quantity) { $sql = "INSERT INTO list_orders (event_id, event_date, ticket_adult_price, ticket_adult_quantity, ticket_kid_price, ticket_kid_quantity) VALUES ('$event_id', '$event_date', '$ticket_adult_price', '$ticket_kid_price', '$ticket_kid_quantity')"; mysqli_query($mysqli, $sql); //$mysqli->prepare($sql); } addOrders(3, '2021-08-21 13:00:00', 700, 1, 450, 0,'11111111');
Show:  
Copy Clear