Browse Source

Merge branch 'master' of github.com:mevdschee/php-crud-api

Maurits van der Schee 7 years ago
parent
commit
0a1c6ea6d6
2 changed files with 6 additions and 1 deletions
  1. 5
    0
      api.php
  2. 1
    1
      extras/core.php

+ 5
- 0
api.php View File

@@ -2419,6 +2419,9 @@ class PHP_CRUD_API {
2419 2419
 						echo '"200":{';
2420 2420
 						echo '"description":"An array of '.$table['name'].'",';
2421 2421
 						echo '"schema":{';
2422
+						echo '"type": "object",';
2423
+						echo '"properties": {';
2424
+						echo '"'.$table['name'].'": {';
2422 2425
 						echo '"type":"array",';
2423 2426
 						echo '"items":{';
2424 2427
 						echo '"type": "object",';
@@ -2451,6 +2454,8 @@ class PHP_CRUD_API {
2451 2454
 						}
2452 2455
 						echo '}'; //properties
2453 2456
 						echo '}'; //items
2457
+						echo '}'; //table
2458
+						echo '}'; //properties
2454 2459
 						echo '}'; //schema
2455 2460
 						echo '}'; //200
2456 2461
 						echo '}'; //responses

+ 1
- 1
extras/core.php View File

@@ -37,7 +37,7 @@ switch ($method) {
37 37
   case 'POST':
38 38
     $sql = "insert into `$table` set $set"; break;
39 39
   case 'DELETE':
40
-    $sql = "delete `$table` where id=$key"; break;
40
+    $sql = "delete from `$table` where id=$key"; break;
41 41
 }
42 42
 
43 43
 // execute SQL statement

Loading…
Cancel
Save