{"id":16668049,"url":"https://github.com/zachsa/old-php-mysql-experiments","last_synced_at":"2026-04-27T14:02:53.611Z","repository":{"id":127335627,"uuid":"245781675","full_name":"zachsa/old-php-mysql-experiments","owner":"zachsa","description":null,"archived":false,"fork":false,"pushed_at":"2020-03-08T08:56:18.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-19T17:09:05.380Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zachsa.png","metadata":{"files":{"readme":"README.txt","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-08T08:55:49.000Z","updated_at":"2020-03-08T08:56:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"47ae1fb3-2032-466d-86ec-7f9fd8cb890f","html_url":"https://github.com/zachsa/old-php-mysql-experiments","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachsa%2Fold-php-mysql-experiments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachsa%2Fold-php-mysql-experiments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachsa%2Fold-php-mysql-experiments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachsa%2Fold-php-mysql-experiments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zachsa","download_url":"https://codeload.github.com/zachsa/old-php-mysql-experiments/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243313411,"owners_count":20271178,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T11:16:03.304Z","updated_at":"2025-12-26T15:27:01.208Z","avatar_url":"https://github.com/zachsa.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"#Just a simple PHP framework with a simple database schema (see below for create schema).\n\n\nIn hindsight, I would have first packaged the SQL query results into data objects. I know that mysqli does this, but I think it would be better to be much clearer on the information that I pass to the tables. I also could have had a better response to non-existing entries. It works now, but a lot of the times registers as an HTML error when I try to validate things.\n\n\n\n#CREATE\nAll create statements are dynamically created by the \"insert_into_db($db)\" function.\n\n\n#RETRIEVE\nA batch of select-statement functions to access the various tables, including a function to swap field names called by the insert function when taking user parameters of the dropdown menu\n\n\n#UPDATE\nNo update functionality\n\n\n#DELETE\nA couple functions to, well, delete things. Each table row containes a form that allows you to call a delete statement, I don't know a better way to do this at this point.\n\n\n#DATABASE SCHEMA CREATE STATEMENT\n\nTable design was done as an ERD diagram in MySQL Workbench, and then forward engineered to create the following: \n\n\nSET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;\nSET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;\nSET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';\n\n-- -----------------------------------------------------\n-- Schema mydb\n-- -----------------------------------------------------\n-- -----------------------------------------------------\n-- Schema bme\n-- -----------------------------------------------------\n\n-- -----------------------------------------------------\n-- Schema bme\n-- -----------------------------------------------------\nCREATE SCHEMA IF NOT EXISTS `bme` DEFAULT CHARACTER SET utf8 ;\nUSE `bme` ;\n\n-- -----------------------------------------------------\n-- Table `bme`.`galleries`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `bme`.`galleries` (\n  `gallery_id` INT(11) NOT NULL AUTO_INCREMENT,\n  `name` VARCHAR(45) NOT NULL,\n  `address` VARCHAR(45) NOT NULL,\n  `contact_person` VARCHAR(45) NOT NULL,\n  `landline` VARCHAR(45) NULL DEFAULT NULL,\n  `cellphone` VARCHAR(45) NULL DEFAULT NULL,\n  PRIMARY KEY (`gallery_id`))\nENGINE = InnoDB\nAUTO_INCREMENT = 2\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `bme`.`photos`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `bme`.`photos` (\n  `photo_id` VARCHAR(20) NOT NULL DEFAULT '',\n  `description` VARCHAR(45) NOT NULL,\n  `native_height_px` VARCHAR(45) NULL DEFAULT NULL,\n  `native_width_px` VARCHAR(45) NULL DEFAULT NULL,\n  PRIMARY KEY (`photo_id`),\n  UNIQUE INDEX `photo_id_UNIQUE` (`photo_id` ASC))\nENGINE = InnoDB\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `bme`.`prints`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `bme`.`prints` (\n  `print_id` INT(11) NOT NULL AUTO_INCREMENT,\n  `photo_id` VARCHAR(20) NOT NULL,\n  `product_id` VARCHAR(45) NOT NULL,\n  `assigned` TINYINT(1) NOT NULL DEFAULT '0',\n  PRIMARY KEY (`print_id`),\n  INDEX `fk_prints_photos1_idx` (`photo_id` ASC),\n  INDEX `fk_product_id_idx` (`product_id` ASC))\nENGINE = InnoDB\nAUTO_INCREMENT = 2\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `bme`.`products`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `bme`.`products` (\n  `product_id` VARCHAR(45) NOT NULL,\n  `print_type` VARCHAR(45) NOT NULL,\n  `description` VARCHAR(45) NOT NULL,\n  `print_cost` VARCHAR(45) NOT NULL,\n  `retail_price` VARCHAR(45) NOT NULL,\n  PRIMARY KEY (`product_id`))\nENGINE = InnoDB\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `bme`.`shops`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `bme`.`shops` (\n  `shop_id` INT(11) NOT NULL AUTO_INCREMENT,\n  `shop_name` VARCHAR(45) NOT NULL,\n  `location` VARCHAR(45) NOT NULL,\n  `shop_telephone` VARCHAR(45) NOT NULL,\n  PRIMARY KEY (`shop_id`))\nENGINE = InnoDB\nAUTO_INCREMENT = 16\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `bme`.`sizes`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `bme`.`sizes` (\n  `size_id` INT(11) NOT NULL AUTO_INCREMENT,\n  `size` VARCHAR(30) NOT NULL,\n  `cost_price` VARCHAR(45) NOT NULL,\n  `retail_price` VARCHAR(45) NOT NULL,\n  PRIMARY KEY (`size_id`))\nENGINE = InnoDB\nDEFAULT CHARACTER SET = utf8;\n\n\n-- -----------------------------------------------------\n-- Table `bme`.`stock_details`\n-- -----------------------------------------------------\nCREATE TABLE IF NOT EXISTS `bme`.`stock_details` (\n  `gallery_id` INT(11) NOT NULL,\n  `print_id` INT(11) NOT NULL,\n  `quantity` INT(11) NULL DEFAULT NULL,\n  `stock_id` INT(11) NOT NULL AUTO_INCREMENT,\n  PRIMARY KEY (`stock_id`),\n  UNIQUE INDEX `print_id_UNIQUE` (`print_id` ASC),\n  INDEX `FK_stock_prints_idx` (`print_id` ASC),\n  INDEX `FK_gallery_id_idx` (`gallery_id` ASC))\nENGINE = InnoDB\nAUTO_INCREMENT = 203\nDEFAULT CHARACTER SET = utf8;\n\n\nSET SQL_MODE=@OLD_SQL_MODE;\nSET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;\nSET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzachsa%2Fold-php-mysql-experiments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzachsa%2Fold-php-mysql-experiments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzachsa%2Fold-php-mysql-experiments/lists"}