Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Ramsey Moketronics

View GitHub Profile
@Moketronics
Moketronics / price-finder.html
Created Apr 19, 2012
Quickly displays appropriate prices w/ tax for various publications
View price-finder.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Quick Price Finder | TSI Network</title>
<script src="./jquery-1.7.2.min.js"></script>
<style type="text/css">
body {
font-family: Arial, Helvetica, sans-serif;
background-color: #eee;
@Moketronics
Moketronics / gist:2228349
Created Mar 28, 2012
Check update values against existing to populate array of changes
View gist:2228349
<?php
$query = 'SELECT tile_name, tile_price, quantity, old_lot_qty, nom_height, nom_width, nom_thick, exact_height, exact_width, box_tile_count, local_supply, rating, tile_notes FROM tiles WHERE tile_id=' . $iTile_id;
$result = mysql_fetch_array(mysql_query($query));
$aTile_changes = array();
$aTile_values = array($sTile_name, $iTile_price, $iQuantity, $iOld_lot_qty, $iNom_height, $iNom_width, $iNom_thick, $iExact_height, $iExact_width, $iBox_tile_count, $iLocal_supply, $iRating, $sTile_notes);
$i = 0;
foreach ($result as $key => $row) {
@Moketronics
Moketronics / functions.php
Created Mar 21, 2012
Functions for tile product management system
View functions.php
<?php
function get_secondary_colours($iTile_id) {
$query_scolour = "SELECT col.colour_name FROM colour AS col, colour_associations AS col_ass WHERE $iTile_id=col_ass.tile_id AND col.colour_id=col_ass.colour_id AND col_ass.b_primary_colour='0'";
$result_scolour = mysql_query($query_scolour);
$aScolours = array();
if ($result_scolour) {
while ($row = mysql_fetch_array($result_scolour)) {
array_push($aScolours, $row['colour_name']);
}
return implode(', ',$aScolours);
View login.php
<?php
/* * * * * * * * * * * * * * * * * * *
*
* Tile Product Management System
* Name: login.php
* Version: DEV
* By: Michael Ramsey (mike@michaelramsey.ca, @moketronics)
*
* Last Updated: March 20, 2012 - Michael Ramsey
View user-db.sql
# MySQL User DB Schema
CREATE TABLE users(
user_id INT(6) NOT NULL AUTO_INCREMENT,
e_mail TEXT NOT NULL,
first_name TEXT NOT NULL,
last_name TEXT NOT NULL,
password CHAR(40) NOT NULL,
permission TINYINT(1) NOT NULL,
date_created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
@Moketronics
Moketronics / add-tile.php
Created Feb 28, 2012
Create new tile entry page - in progress
View add-tile.php
<?php
$sPage_title = 'Add New Tile';
include ('./includes/header.html');
require_once('../../../mysql_connect.php');
?>
<script type="text/javascript">
$("#manufacturer_list").click(function(){ $("#series_list").removeAttr('disabled');});
</script>
<h1 id="mainhead">Use this form to add tiles!</h1>
@Moketronics
Moketronics / full-inventory.php
Created Feb 27, 2012
Full inventory display - in progress, currently for testing
View full-inventory.php
<?php
/* * * * * * * * * * * * * * * * * * *
*
* Tile Product Management System
* Name: full-inventory.php
* Version: DEV
* By: Michael Ramsey (mike@michaelramsey.ca, @moketronics)
*
* Last Updated: March 21, 2012 - Michael Ramsey
@Moketronics
Moketronics / generator.php
Created Feb 25, 2012
Basically complete tile product entry generator
View generator.php
<?php
$sPage_title = 'Random Tile Generator';
include ('./includes/header.html');
require_once('../../../mysql_connect.php');
if (isset($_POST['submitted'])) {
if (is_numeric($_POST['quantity'])) {
@Moketronics
Moketronics / full-inventory.php
Created Feb 25, 2012
Inventory page currently printing all information to simple table
View full-inventory.php
<?php
$sPage_title = 'Full Inventory';
include ('./includes/header.html');
require_once('../../../mysql_connect.php');
?>
<table>
<tr>
<th>Tile ID:</th>
<th>Tile name:</th>
@Moketronics
Moketronics / generator.php
Created Feb 24, 2012
Generator for Tile DB
View generator.php
<?php
$sPage_title = 'Random Tile Generator';
include ('./includes/header.html');
if (isset($_POST['submitted'])) {
if (is_numeric($_POST['quantity'])) {
require_once('../../../mysql_connect.php');