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
 						echo '"200":{';
2419
 						echo '"200":{';
2420
 						echo '"description":"An array of '.$table['name'].'",';
2420
 						echo '"description":"An array of '.$table['name'].'",';
2421
 						echo '"schema":{';
2421
 						echo '"schema":{';
2422
+						echo '"type": "object",';
2423
+						echo '"properties": {';
2424
+						echo '"'.$table['name'].'": {';
2422
 						echo '"type":"array",';
2425
 						echo '"type":"array",';
2423
 						echo '"items":{';
2426
 						echo '"items":{';
2424
 						echo '"type": "object",';
2427
 						echo '"type": "object",';
2451
 						}
2454
 						}
2452
 						echo '}'; //properties
2455
 						echo '}'; //properties
2453
 						echo '}'; //items
2456
 						echo '}'; //items
2457
+						echo '}'; //table
2458
+						echo '}'; //properties
2454
 						echo '}'; //schema
2459
 						echo '}'; //schema
2455
 						echo '}'; //200
2460
 						echo '}'; //200
2456
 						echo '}'; //responses
2461
 						echo '}'; //responses

+ 1
- 1
extras/core.php View File

37
   case 'POST':
37
   case 'POST':
38
     $sql = "insert into `$table` set $set"; break;
38
     $sql = "insert into `$table` set $set"; break;
39
   case 'DELETE':
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
 // execute SQL statement
43
 // execute SQL statement

Loading…
Cancel
Save