Пример #1
2
function PHPTutorials()
{
    //echo$ip=getIp();
    echo "\n<div class='container_fluid'>\n<center><table width='800'>\n    <tr>";
    openDB();
    $getPro_id = mysql_query("select * from products where product_link='php.php'");
    $split = 0;
    while ($row_pro = mysql_fetch_array($getPro_id)) {
        $prod_id = $row_pro['product_id'];
        $prod_title = $row_pro['product_title'];
        $prod_price = $row_pro['product_price'];
        $prod_image = $row_pro['product_image'];
        $pro_desc = $row_pro['product_desc'];
        $split++;
        echo "\n\t\t\t\t\t\t<td width='400' style='padding:5px;'><h3>{$prod_title}</h3>\n\t\t\t\t\t\t<br>\n\t\t\t\t\t\t<a href='../pages/details2.php?pro_id={$prod_id}'>\n\t\t\t\t\t\t<br>\n\t\t\t\t\t\t<image src='../Images/{$prod_image}' width='200' height='100'></image></a>\n\t\t\t\t\t\t<br>\n\t\t\t\t\t\t<h4><strong>Price: \$ {$prod_price}</strong></h4>\n\t\t\t\t\t\t<br><br><h4>Description:</h4><br>{$pro_desc}<br><br>\n\t\t\t\t\t\t<a href='../pages/details2.php?pro_id={$prod_id}'>Details</a>\n\t\t\t\t\t\t<a href='http://www.smcleodtech.com.au/index.php?add_cart={$prod_id}'>\n\t\t\t\t\t\t<button>Add to Cart</button></a></td>";
        if ($split % 3 == 0) {
            echo "\n\t\t\t\t\t\t</tr><tr>";
        }
    }
    cart();
    closeDB();
    echo "</tr><br>\n    </table></center>\n    </div>";
}
Пример #2
1
        $query = "SELECT order_id FROM orders WHERE user_id = '{$userID}' and product_id = '{$productID}'";
        $result = mysqli_query($db, $query);
        if (!$result) {
            die('Invalid query: ' . mysqli_error($db));
        }
        $row = mysqli_fetch_array($result, MYSQLI_ASSOC);
        $count = mysqli_num_rows($result);
        if ($count == 1) {
            $orderID = $row['order_id'];
            $query = "UPDATE orders SET qty=qty+1 WHERE order_id='{$orderID}'";
            $data = mysqli_query($db, $query);
            if (!$data) {
                die('Invalid query: ' . mysqli_error($db));
            }
        } else {
            $query = "INSERT INTO orders(user_id, product_id) VALUES ('{$userID}', '{$productID}')";
            $data = mysqli_query($db, $query);
            if (!$data) {
                die('Invalid query: ' . mysqli_error($db));
            }
        }
    }
}
if (!$_SESSION['login_user']) {
    echo "<br>You need to login first";
    echo "</br></br>This page will redirect in 5 seconds";
    header("refresh:5;url={$base_url}/views/home.php");
} else {
    cart($db);
    header("location: {$base_url}/views/home.php");
}
Пример #3
0
function total()
{
    $totaal = 0;
    foreach (cart() as $albumId) {
        $totaal += searchAlbum($albumId)["price"];
    }
    return $totaal;
}
Пример #4
0
<?php

require_once 'admin_carrello.php';
?>

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="public/css/shop.css" media="all">
    </head>
    <body>
       <div id="shop">
           <a href="http://spano.sc.unica.it/amm2015/scanuAndrea/Iosonouncane/index.php">Home Page<br /><br /></a>
           Nel nostro Shop potrai acquistare i CD di Iosonouncane <br />
           e pagarli in sicurezza tramite Paypal!
        <?php 
products();
?>
        
        <br /> <br />
        
        <?php 
cart();
?>
       </div>
    </body>
</html>
Пример #5
0
<?php

include "albums.php";
/* file uit boeken.php wordt uitgelezen en als onderdeel van de huidige php file gezien*/
include "cart.php";
$theAlbum = searchAlbum($_POST["isbn"]);
echo "U heeft <i>" . $theAlbum["name"] . "</i> besteld.";
?>
<h3>uw winkelwagen:</h3>
<table>
<?php 
voegBoekToeAanWiWa($theAlbum["id"]);
foreach (cart() as $albumId) {
    $album = searchAlbum($albumId);
    echo "<tr><td>";
    echo '<img height="80" src="img/' . $album['afbeelding'] . '">';
    echo "</td><td>";
    echo $album["titel"];
    echo "</td><td>";
    echo number_format($album['prijs'] / 100, 2);
    echo "</td></tr>";
}
echo "<tr><td></td><td>totaal:</td><td>" . number_format(totaalBedrag() / 100, 2) . "</td></tr>";
?>
</table>
doei...