Ejemplo n.º 1
0
        $timestamp = mysql_result($proQuery, 0, "timestamp");
        $bc = "shoe";
        //default container is a shoe
        //retrieves container id from products
        $container = mysql_result($proNameQuery, 0, "containerID");
        //queries the container name from the container table
        $query = "SELECT Name FROM containers WHERE ID = {$container} ";
        $contNames = !is_null($query) ? mysql_query($query) : null;
        $containerName = mysql_result($contNames, 0, "Name");
        if (!($quantity == 1)) {
            $bc = $containerName . "s";
        } else {
            $bc = $containerName;
        }
        $dateOfInsertion = new dateTime();
        $dateOfInsertion->setTimestamp(strtotime($timestamp));
        echo "<tr style='vertical-align:top;text-align:center;height:1em;margin-right:auto;margin-left:auto;background-color:";
        if ($productCounter % 2) {
            echo "#b3d9ff";
        } else {
            echo "white";
        }
        //every even row is this color
        echo "'>\r\n\t\t\t\t\t<td>" . $dateOfInsertion->format('d M Y') . "</td>\r\n\t\t\t\t\t<td>" . $productName . "</td>\r\n\t\t\t\t\t<td>" . $quantity . " " . $bc . "(" . $volume . "oz)</td>\r\n\t\t\t\t\t<td>" . $quantity * $volume . " oz</td>\r\n\t\t\t\t\t<td>" . $abv . "%</td>\r\n\t\t\t\t\t<td>\$" . $price . "</td>\r\n\t\t\t\t\t<td>\$" . number_format($price / ($quantity * $volume), 3) . "</td>\r\n\t\t\t\t\t<td>\$" . number_format($price / ($abv / 100 * ($quantity * $volume)), 3) . "</td>\r\n\t\t\t\t\t</tr>";
    } elseif (mysql_num_rows($proNameQuery) == 0) {
    }
    //a price in this town belongs to a product that does not match the search results. no big deal.
}
echo "</tbody></table>";
//insert the failed search result method after the price table
if (isset($_GET['search']) && $productCounter == 0) {