Code Monkey home page Code Monkey logo

sniper's Introduction

phpSniper

phpSniper is a PHP library that provides a collection of functions to simplify database operations such as CRUD (Create, Read, Update, and Delete) and other common tasks in PHP web development.

Requirements

  • PHP 5.4 or higher
  • MySQL 5.0 or higher

Installation

  1. Clone the phpSniper repository or download it as a zip file and extract it in your project folder.
  2. Open the functions/config.php file and enter your MySQL database credentials.
  3. Include the sniper.php file in your PHP script to start using the library.

Usage

Here's an example of how to use the select function to retrieve all rows from a database table:

include 'path/to/sniper.php';

$rows = select('users');

foreach ($rows as $row) {
    echo $row['name'];
}

You can also use the insert function to insert data into a table:

include 'path/to/sniper.php';

$table = 'users';
$columns = 'name, email';
$values = "'John Doe', '[email protected]'";

$inserted = insert($table, $columns, $values);

if ($inserted) {
    echo "Data inserted successfully!";
} else {
    echo "Failed to insert data!";
}

Function List

  • connect() - Establish a database connection
  • closeConnection() - Close the database connection
  • insert($table, $cols, $values) - Insert data into a database table
  • updateRow($table, $colsAndValues, $conditions) - Update multiple columns and values in a database table
  • updateCol($table, $col, $value, $key, $id) - Update a single column value in a database table
  • delete($table, $condition) - Delete row(s) from a database table based on a condition
  • search($data, $query) - Search for a string in data
  • getInfo($table, $condition, $cols = null) - Retrieve complete row information from a database table.

phpSniper is open source software released under the MIT license.

© Suraj Muhammad

sniper's People

Contributors

soorajlegend 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.