Code Monkey home page Code Monkey logo

cbp-challenge-winter2017-week3's Introduction

Week 3 challenge

Contents

The data folder that will hold all the saved data. Make sure that it is writable by PHP in your OS. On Mac OSX try this command (while in this folder in the terminal):

sudo chmod -R a+w data

The lib folder containing the library data-functions.php that contains all the functions necessary to manipulate saved data

How to use

Require the file lib/data-functions.php in your script(s).

get_index

$index = get_index();

Returns an array containing pairs of item id and item name. Should be used for creating a list of items.

get_data

$data = get_data($id);

Retrieves saved data for one item based on the given $id argument. First argument is the id of the item that should be retrieved. The returned data is an array containing pairs of data name and data value.

insert_data

insert_data($data);

Saves the given data as a new item. The argument should be an array containing pairs of data name and data value. For proper generating of index, make sure that data always contains a value with the key 'name'.

update_data

update_data($id, $data);

Updates data for a specific saved item. If that item does not exists a new item is created. First argument is the id of the item that should be updated. The second argument should be an array containing pairs of data name and data value.

delete_data

delete_data($id);

Deletes a saved item from the index and deletes it's saved data. First argument is the id of the item that should be deleted.

cbp-challenge-winter2017-week3's People

Contributors

polakjan avatar

Watchers

James Cloos 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.