simpleWordsCloud/get.php

24 lines
408 B
PHP
Raw Normal View History

2020-11-15 21:51:28 +01:00
<?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'];
2020-11-25 22:53:07 +01:00
if ($words = $db->getWordsList($id)) {
$wordsClean = [];
foreach ($words as $key => $word) {
$wordsClean[] = array($word['word'], $word['relative']);
}
echo json_encode($wordsClean);
2020-11-15 21:51:28 +01:00
} else {
echo json_encode('No id');
}