{"action":"created","issue":{"url":"https://api.github.com/repos/mevdschee/php-crud-api/issues/96","repository_url":"https://api.github.com/repos/mevdschee/php-crud-api","labels_url":"https://api.github.com/repos/mevdschee/php-crud-api/issues/96/labels{/name}","comments_url":"https://api.github.com/repos/mevdschee/php-crud-api/issues/96/comments","events_url":"https://api.github.com/repos/mevdschee/php-crud-api/issues/96/events","html_url":"https://github.com/mevdschee/php-crud-api/issues/96","id":172398041,"number":96,"title":"Can you explain about insert method in php-crud-api?","user":{"login":"vanloc0301","id":4168981,"avatar_url":"https://avatars.githubusercontent.com/u/4168981?v=3","gravatar_id":"","url":"https://api.github.com/users/vanloc0301","html_url":"https://github.com/vanloc0301","followers_url":"https://api.github.com/users/vanloc0301/followers","following_url":"https://api.github.com/users/vanloc0301/following{/other_user}","gists_url":"https://api.github.com/users/vanloc0301/gists{/gist_id}","starred_url":"https://api.github.com/users/vanloc0301/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vanloc0301/subscriptions","organizations_url":"https://api.github.com/users/vanloc0301/orgs","repos_url":"https://api.github.com/users/vanloc0301/repos","events_url":"https://api.github.com/users/vanloc0301/events{/privacy}","received_events_url":"https://api.github.com/users/vanloc0301/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-22T08:45:36Z","updated_at":"2016-08-22T16:58:43Z","closed_at":null,"body":"You're responsive very well.\r\n\r\nBut I meet difficult when to read your code.\r\n\r\nWhat I don't know at line rows is insert into the table in your code.\r\n\r\nI found:\r\n\r\n\r\n```\r\nif ($version != $this->db->querySingle('SELECT \"version\" from \"sys/version\"')) {\r\n\t// reflection may take a while\r\n\tset_time_limit(3600);\r\n\t// update version data\r\n\t$this->query('DELETE FROM \"sys/version\"');\r\n\t$this->query('INSERT into \"sys/version\" (\"version\") VALUES (?)',array($version));\r\n\t// update tables data\r\n\t$this->query('DELETE FROM \"sys/tables\"');\r\n\t$result = $this->query('SELECT * FROM sqlite_master WHERE type = \"table\" and name not like \"sys/%\" and name<>\"sqlite_sequence\"');\r\n\t$tables = array();\r\n\twhile ($row = $this->fetchAssoc($result)) {\r\n\t\t$tables[] = $row['name'];\r\n\t\t$this->query('INSERT into \"sys/tables\" (\"name\") VALUES (?)',array($row['name']));\r\n\t}\r\n\t// update columns and foreign_keys data\r\n\t$this->query('DELETE FROM \"sys/columns\"');\r\n\t$this->query('DELETE FROM \"sys/foreign_keys\"');\r\n\tforeach ($tables as $table) {\r\n\t\t$result = $this->query('pragma table_info(!)',array($table));\r\n\t\twhile ($row = $this->fetchRow($result)) {\r\n\t\t\tarray_unshift($row, $table);\r\n\t\t\t$this->query('INSERT into \"sys/columns\" (\"self\",\"cid\",\"name\",\"type\",\"notnull\",\"dflt_value\",\"pk\") VALUES (?,?,?,?,?,?,?)',$row);\r\n\t\t}\r\n\t\t$result = $this->query('pragma foreign_key_list(!)',array($table));\r\n\t\twhile ($row = $this->fetchRow($result)) {\r\n\t\t\tarray_unshift($row, $table);\r\n\t\t\t$this->query('INSERT into \"sys/foreign_keys\" (\"self\",\"id\",\"seq\",\"table\",\"from\",\"to\",\"on_update\",\"on_delete\",\"match\") VALUES (?,?,?,?,?,?,?,?,?)',$row);\r\n\t\t}\r\n\t}\r\n}\r\n```\r\n\r\nCan you explain this code? I integrate to my Laravel system.\r\n\r\nAnd in Postman, I tried to insert like this:\r\n\r\n![capture](https://cloud.githubusercontent.com/assets/4168981/17848736/4c92592a-687f-11e6-887e-9b1cd18caceb.PNG)\r\n\r\nBut it return values is null.\r\n"},"comment":{"url":"https://api.github.com/repos/mevdschee/php-crud-api/issues/comments/241478415","html_url":"https://github.com/mevdschee/php-crud-api/issues/96#issuecomment-241478415","issue_url":"https://api.github.com/repos/mevdschee/php-crud-api/issues/96","id":241478415,"user":{"login":"mevdschee","id":1288217,"avatar_url":"https://avatars.githubusercontent.com/u/1288217?v=3","gravatar_id":"","url":"https://api.github.com/users/mevdschee","html_url":"https://github.com/mevdschee","followers_url":"https://api.github.com/users/mevdschee/followers","following_url":"https://api.github.com/users/mevdschee/following{/other_user}","gists_url":"https://api.github.com/users/mevdschee/gists{/gist_id}","starred_url":"https://api.github.com/users/mevdschee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mevdschee/subscriptions","organizations_url":"https://api.github.com/users/mevdschee/orgs","repos_url":"https://api.github.com/users/mevdschee/repos","events_url":"https://api.github.com/users/mevdschee/events{/privacy}","received_events_url":"https://api.github.com/users/mevdschee/received_events","type":"User","site_admin":false},"created_at":"2016-08-22T16:58:43Z","updated_at":"2016-08-22T16:58:43Z","body":"Additionally you uncomment this line to understand what is going on: \r\n\r\nhttps://github.com/mevdschee/php-crud-api/blob/master/api.php#L120"}}
{"actor":{"display_login":"mevdschee"}}