Beispiel #1
0
function displayAllProducts()
{
    $sql = "SELECT productId, productName FROM oe_product ORDER BY productName";
    $records = getDataBySQL($sql);
    /* //Using HTML Links
       foreach ($records as $record) {
           echo $record['productName']; 
           echo " <a href='updateProduct.php?productId=".$record['productId']."'> Update </a> ";
           echo " <a href='deleteProduct.php'> Delete </a>";
           echo "<br />";
       }
       */
    //Using Form Buttons
    echo "<table>";
    foreach ($records as $record) {
        echo "<tr>";
        echo "<td>" . $record['productName'] . "</td>";
        echo "<td> <form action=updateProduct.php>";
        echo "<input type='hidden' name='productId' value='" . $record['productId'] . "'/>";
        echo "<input type='submit' value='Update'/></form> </td>";
        echo "</tr>";
    }
    //endForeach
    echo "</table>";
}
Beispiel #2
0
function displayAllProducts()
{
    $sql = "SELECT productName, price, productId FROM oe_product";
    $records = getDataBySQL($sql);
    return $records;
    /*
    	foreach($records as $record) {
    		echo $record['productName'] . "-" . $record['price'] . "<br>";
    	}
    */
}
function displaySongInfo()
{
    $sql = "SELECT songName, artistName, albumName, length, genreName, artistWiki, releaseDate\r\n                FROM as_song s\r\n\t\t\t\tINNER JOIN as_album a\r\n\t\t\t\tON s.albumId = a.albumId\r\n\t\t\t\tINNER JOIN as_artist i\r\n\t\t\t\tON a.artistId = i.artistId\r\n\t\t\t\tINNER JOIN as_genre g\r\n\t\t\t\tON g.genreId = a.genreId\r\n                WHERE s.songId = " . $_GET['songId'];
    $records = getDataBySQL($sql);
    return $records;
}
function getStatistics()
{
    $sql = "SELECT MIN(rating) AS low, MAX(rating) AS high, AVG(rating) AS average, COUNT(*) AS total \n\t\t\tFROM oc_movies";
    $records = getDataBySQL($sql);
    foreach ($records as $record) {
        echo "Lowest Rating: " . $record['low'] . "<br />";
        echo "Highest Rating: " . $record['high'] . "<br />";
        echo "Average Rating: " . $record['average'] . "<br />";
        echo "Total Movies: " . $record['total'] . "<br />";
    }
}
Beispiel #5
0
function sumQ()
{
    $sql = "SELECT  SUM(quantity) as sumq \n\t\t\t\tFROM gp_Order";
    $records = getDataBySQL($sql);
    foreach ($records as $record) {
        echo "<tr></tr>";
        echo "<td id='name'>" . $record['sumq'] . "</td>";
    }
}
Beispiel #6
0
<?php

include 'includes/database.inc.php';
$conn = getDatabaseConnection();
//gets database connection
if (isset($_GET['ISBN'])) {
    $sql = "SELECT ISBN, summary,title\r\n    FROM gp_Books WHERE ISBN = " . $_GET['ISBN'];
    $records = getDataBySQL($sql);
    foreach ($records as $record) {
        echo "<div class='productName'><a class='title'>TITLE</a></div>";
        echo "<br/>";
        echo "<div style='text-align: center; font-size: 20px; color: green; font-weight: 600; height: 70px;'>" . $record['title'] . "</div>" . "<br />";
        echo "<div class='productName'><a class='title'>SUMMARY</a></div>";
        echo "<br/>";
        echo "<div style='text-align: center; font-size: 15px; color: green; font-weight: 600'>" . $record['summary'] . "</div>" . "<br />";
    }
}
?>
<link href="css/styles.css" rel="stylesheet">
Beispiel #7
0
function orderByAuthor()
{
    $sql = "SELECT \ta.title, a.author\nFROM \tgp_Books a, gp_Customer b, gp_Order c\nWHERE \tb.cust_Id = c.cust_Id\nAND\tc.ISBN = a.ISBN\nGROUP BY\ta.author\nORDER BY\ta.author ASC;";
    $records = getDataBySQL($sql);
    return $records;
}
Beispiel #8
0
function displayAllProducts()
{
    $sql = "SELECT productName, price FROM oe_product";
    $records = getDataBySQL($sql);
    return $records;
}
Beispiel #9
0
function displayAllProducts()
{
    $sql = "SELECT p.`prd_pricing` , p.`prd_sell_Id` , p.`prd_movie_Id` , s.`prd_sell_name` , m.`prd_movie_nm` , m.`prd_movie_year`, m.`prd_movie_dir` \n" . "FROM `prd_movie` m, `prd_pricing` p\n" . "LEFT OUTER JOIN `prd_sell_typ` s ON s.`prd_sell_Id` = p.`prd_sell_Id` \n" . "WHERE p.`prd_movie_Id` = m.`prd_movie_Id` LIMIT 0, 30 ";
    $records = getDataBySQL($sql);
    return $records;
}
Beispiel #10
0
function displayAllSongs()
{
    $sql = "SELECT songId, songName, artistName, albumName, length, genreName\n\t\t\tFROM as_song s\n\t\t\tINNER JOIN as_album a\n\t\t\tON s.albumId = a.albumId\n\t\t\tINNER JOIN as_artist i\n\t\t\tON a.artistId = i.artistId\n\t\t\tINNER JOIN as_genre g\n\t\t\tON g.genreId = a.genreId";
    $records = getDataBySQL($sql);
    return $records;
}