function createNewOrder($acc_id, $product_id)
{
    global $con;
    // Vloz hodnotu do tabulky orders - napln iba status na 'processing' a dopln kto objednava
    $sql = "INSERT INTO orders (order_userid, order_status) VALUES ('{$acc_id}','processing')";
    $run_data = mysqli_query($con, $sql);
    // Znova volaj rekurzivne funkciu checkMyOrders- teraz bude rowcount uz jedna vdaka zaciatku tejto funkcie, tj if statement sa vyhodnoti ako spravny, a zavola sa funkcia na pridanie produktu do orderu.
    checkMyOrders($acc_id, $product_id);
}
示例#2
0
<?php

session_start();
include "php/functions.php";
if (isset($_GET['addproducttocart']) && $_GET['addproducttocart'] == 'true') {
    $product_id = $_GET['pro_id'];
    checkMyOrders($_SESSION['account_id'], $product_id);
}
?>

<!DOCTYPE html>
<html>
<head>
  	<meta charset='utf-8'>
  	<title>TechPoint</title>
  	<meta name="description" content="TechPoint">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link href="css/bootstrap.min.css" rel="stylesheet">
  	<link rel="stylesheet" href="css/internal/style.css">
  	<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
</head>

<body>
	<?php 
include "navbar.php";
?>
	<?php 
if (isset($_GET['errorcode']) && $_GET['errorcode'] == 'duplicate') {
    displayAlert('info', 'Info!', 'Product is already in your order. To edit quantity click on shopping cart!', 5);