PHP Classes

Edit, eliminate, search, and sort table records: Maintain tables in a MySQL database

Recommend this page to a friend!
  All requests RSS feed  >  Edit, eliminate, search, and sort tab...  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

Edit, eliminate, search, and sort table records

Edit

Picture of jurgen muller by jurgen muller - 8 years ago (2016-10-02)

Maintain tables in a MySQL database

This request is clear and relevant.
This request is not clear or is not relevant.

+3

I need to connect to a MySQL database with MySQLi table and edit, eliminate, search, and sort table records.

Ask clarification

2 Recommendations

DataBase Object (DBO): Manipulate database table records

This package can manipulate database table records.

There is one class that connects to database and execute queries.

Another class performs common operations with database table records based on information of the tables and fields stored in class variables.

Currently it can perform operations like creating, updating, deleting records, load records, validate record values, get a list records, delete a list of records.

Applications may create sub-classes with predefined values for specific tables with given fields.
This recommendation solves the problem.
This recommendation does not solve the problem.

+2

Picture of Oleg Zorin by Oleg Zorin package author package author Reputation 75 - 8 years ago (2016-10-18) Comment

Also you can use DataBase Object (DBO) paradigm.

For example, basic user DBO class:

Class User extends OZ\DBO { public $name; public $login;

public static $definition = array(

'table' => 'users',
'id' => 'userID',
  'fields' => array(
  'name' => array('type' => 'text', 'required' => true),
  'login' => array('type' => 'text', 'required' => true, 'unique' => true)
)

);

function __construct($id = 0) {

parent::__construct($id);

} }

Now you can use your user object like:

  • Update name of user with ID 35: $user = new User(35); $user->name = 'New name'; $user->save();
  • Delete user with ID 12: $user = new User(12); $user->delete();

Or simple use static deleteList method: User::deleteList(array(12));

  • Create new user and check login: $user = new User(); $user->name = 'Name'; $user->login = 'Login'; $validation = $user->validate(); if($validation['result']) { $user->save(); } else { print_r($validation['errors']); }

This page provides DB class also. Simple static wrapper for PDO class. It's visible in every context of you application.

This class is required for DBO class.


PDO DB Connector: Connect and execute common queries using PDO

This class can connect and execute common queries using PDO.

There is a base class that establishes connections to a given database using PDO. It has functions dedicated to connect to MySQL and Microsoft SQL server databases.

A sub-classe provides functions to perform common queries. Currently it can:

- Execute arbitrary SQL queries and return the results in an array
- Query a table and return a single column of results as an array
- Query a table and return all rows as an array
- Execute INSERT or UPDATE queries without prepared values
- Delete table rows that match a condition
This recommendation solves the problem.
This recommendation does not solve the problem.

+3

Picture of Itay Segal by Itay Segal package author package author Reputation 40 - 8 years ago (2016-10-10) Comment

you can you this PDO db connector


Recommend package
: 
: