-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathparams.json
More file actions
1 lines (1 loc) · 1.94 KB
/
Copy pathparams.json
File metadata and controls
1 lines (1 loc) · 1.94 KB
1
{"name":"Simple-txtdb","tagline":"Php Class to build database with txt files.","body":"Php TxtDb Class\r\n================\r\nI have written this class for simple usage for txt files as database. This is a simple way to store datas in txt files. If you dont want to use Mysql, Mssql, SQLite etc. use this class.\r\n\r\nLogic is simple;\r\nYour directory = Your Database,\r\nYour files = Your Tables,\r\nFile contents = Table Rows\r\n\r\n\r\n#Usage\r\n===============\r\n\r\n require(\"txtdb.class.php\");\r\n\r\n $db = new TxtDb();\r\n \r\nthats it. Or;\r\n\r\n $db = new TxtDb('name' => 'TABLE-NAME',\r\n 'path' => 'db/',\r\n 'extension' => '.txtdb',\r\n 'encrypt' => FALSE);\r\n \r\n\r\nEncryption is used to encrypt file names.\r\n\r\n###Inserting Data\r\nThis method gets two parameters. \r\nFirst is \"table name\", second is our data in array.\r\n\r\n $db->insert(\"teachers\", \r\n array(\"name\" => \"John Doe\",\r\n \"email\" => \"john@google.com\")\r\n );\r\n \r\n\r\n###Update\r\nThis method gets three parameters.\r\nFirst is \"table name\", second is our data in array and third is \"where situation\"\r\n\r\n $db->update(\"teachers\", \r\n array(\"name\" => \"Jen Doe\",\r\n \"email\" => \"jen@google.com),1);\r\n \r\n\r\n###Delete\r\n\r\n $db->delete(\"students\",1);\r\n \r\nImportant : If you dont set second param, this method deletes all contents in file!\r\n\r\n \r\n###Select\r\nThis method returns array object.\r\n\r\n $students = $db->select('students');\r\n \r\n foreach($students as $student){\r\n echo $student->name;\r\n }\r\n \r\n \r\n###Select One Row\r\nThis method list one row by second param\r\n\r\n $user = $db->select('students',1);\r\n \r\n echo $user->name;\r\n //output\r\n John Doe\r\n\r\n\r\nEasy? huh.\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}