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

+2

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 recommendation solves the problem.
This recommendation does not solve the problem.

+1

Picture of Oleg Zorin by Oleg Zorin package author package author Reputation 65 - 7 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 recommendation solves the problem.
This recommendation does not solve the problem.

+2

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

you can you this PDO db connector


Recommend package
: 
: