Skip to content

chandimab/php-mysql-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Minimal PHP Library to Manipulate MySQL database

The MySQL table used in this example

CREATE TABLE `Config` (
  `Config_Key` varchar(255) NOT NULL,
  `Config_Value` varchar(255) NOT NULL
)
//database connection
$database = new Database();
$db = $database->getConnection();

//entity fields definition
$fields = '{
"Config_Key":"config_key",
"Config_Value":"config_value"
}';

//create entity object
$entity = new Entity(
    $db, //database connection
    'Config', //table name in mysql database
    $fields //fields in the table
);

//set values of the object
$values = array("key_1","value_2");
$entity->setFieldValues(\$values);

//perform operation
$entity->insert();

Releases

No releases published

Packages

No packages published

Languages