Giter Club home page Giter Club logo

php_shopping_cart's Introduction

Shopping_cart

Shopping Cart with Php and MySqli Database.

✨Before you execute this project run a local server environment like MAMP.

✨Now create the database:

CREATE DATABASE yourdatabasename;

✨Now create two tables:

CREATE TABLE `categories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(32) NOT NULL,
  PRIMARY KEY (`id`)
);

CREATE TABLE `products` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `category_id` int(11) NOT NULL,
  `name` varchar(32) NOT NULL,
  `description` text NOT NULL,
  `price` double NOT NULL,
  `image` text NOT NULL,
  PRIMARY KEY (`id`)
);

✨ Now insert some values in the database:

INSERT INTO `categories` VALUES(1, 'Toys');
INSERT INTO `categories` VALUES(2, 'Electronics');
INSERT INTO `categories` VALUES(3, 'Clothing');

INSERT INTO `products` VALUES(1, 1, 'Beach Toys', 'Beach toys description here.', 8.99, 'product_beachtoys.jpg');
INSERT INTO `products` VALUES(2, 1, 'Stuffed Bear', 'Stuffed bear description here.', 15.99, 'product_bear.jpg');
INSERT INTO `products` VALUES(3, 2, 'Computer Monitor', 'Computer monitor description here.', 299.99, 'product_computermonitor.jpg');
INSERT INTO `products` VALUES(4, 1, 'Stuffed Hippo', 'Stuffed Hippo description.', 13, 'product_hippo.jpg');
INSERT INTO `products` VALUES(5, 1, 'Stuffed Reindeer', 'Reindeer description here.', 14.49, 'product_reindeer.jpg');
INSERT INTO `products` VALUES(6, 2, 'Headphones', 'Headphones description here', 19.99, 'product_headphones.jpg');

✨ Now go to "init.php" and update your database variables:

// connect to db
$server = 'localhost';
$user = 'root';
$password = 'root';
$db = 'php_shoppingcart';
$Database = new mysqli($server, $user, $password, $db);

👍👍👍

php_shopping_cart's People

Contributors

tonig-78 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.