{"id":18555677,"url":"https://github.com/n2ref/database","last_synced_at":"2025-05-15T13:10:21.748Z","repository":{"id":10025889,"uuid":"12066994","full_name":"n2ref/DataBase","owner":"n2ref","description":"The class to use a database","archived":false,"fork":false,"pushed_at":"2014-01-07T18:40:19.000Z","size":168,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-17T11:29:44.919Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/n2ref.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-12T21:41:30.000Z","updated_at":"2014-01-07T18:40:19.000Z","dependencies_parsed_at":"2022-08-28T13:52:17.489Z","dependency_job_id":null,"html_url":"https://github.com/n2ref/DataBase","commit_stats":null,"previous_names":["n2ref/database"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n2ref%2FDataBase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n2ref%2FDataBase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n2ref%2FDataBase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n2ref%2FDataBase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/n2ref","download_url":"https://codeload.github.com/n2ref/DataBase/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254346626,"owners_count":22055809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T21:27:33.795Z","updated_at":"2025-05-15T13:10:21.718Z","avatar_url":"https://github.com/n2ref.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"DataBase\n========\n\nClass for using the database, with the ability to use different adapters such as 'Mysqli', 'PostgreSQL', 'Mssql' and some other\n\n\n\nSimple example, initialize and select \n\n```php\nrequire_once 'class.database.php';\n$db = new DB('PDO_Mysql', 'localhost', 'workbase', 'user_name', 'user_pass');\n\n$result_array = $db-\u003efetchRow(\"\n\t\tSELECT title, \n\t\t\t   description,\n\t\t\t   data\n\t\tFROM   table_name\n\t\tWHERE  id = ?\n\", $id);\n\n// also exists methods fetchAll, fetchOne\n```\n\nSlightly more complex example of using a method 'query'\n\n```php\n$db = new DB('PDO_Mysql', 'localhost', 'workbase', 'user_name', 'user_pass');\n\n// here is screened and paste parameters in the query\n\n$is_add = $db-\u003equery(\"\n\t\tINSERT INTO table_items (\n\t\t\ttitle, \n\t\t\tpreview, \n\t\t\tcontent,\n\t\t\tcategory_id, \n\t\t\tuser_id, \n\t\t\tpublished,\n\t\t\tlast_modified\n\t\t) VALUE (\n\t\t\t:title,\n\t\t\t:preview,\n\t\t\t:content,\n\t\t\t:category_id,\n\t\t\t:user_id,\n\t\t\t'1',\n\t\t\tNOW()\n\t\t)\n\t\", array(\n\t\t'title' \t  =\u003e $item['title'], \n\t\t'preview' \t  =\u003e $item['preview'], \n\t\t'content' \t  =\u003e $item['content'], \n\t\t'category_id' =\u003e $item['category_id'], \n\t\t'user_id' \t  =\u003e $item['user_id']\n\t)\n);\n\nif ($is_add) {\n\t$item_id = $db-\u003elastInsertId();\n}\n\n$db-\u003eclose();\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn2ref%2Fdatabase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fn2ref%2Fdatabase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn2ref%2Fdatabase/lists"}