23 lines
408 B
PHP
23 lines
408 B
PHP
<?php
|
|
|
|
include('db.php');
|
|
$db = new DataBase();
|
|
if (!$db->isInit()) {
|
|
echo 'Error db init';
|
|
return;
|
|
}
|
|
|
|
if (!isset($_GET['id'])) {
|
|
echo json_encode(false);
|
|
}
|
|
$id = $_GET['id'];
|
|
|
|
if ($words = $db->getWordsList($id)) {
|
|
$wordsClean = [];
|
|
foreach ($words as $key => $word) {
|
|
$wordsClean[] = array($word['word'], $word['relative']);
|
|
}
|
|
echo json_encode($wordsClean);
|
|
} else {
|
|
echo json_encode('No id');
|
|
}
|