I can retrieve records from my tables above 5000 record minimal, and I have four ways to do it, and I don't know which and why is the suitable for my requested work and which is best if it was lesser records: (Queries)
#---- Rows
SELECT
  a.`id`,
  a.`content`
FROM
  `docs` a;
I use while() loop for each row:
while ($row = $rows->fetch()) {
  echo "<option value=\"{$row['id']}\">{$row['content']}</option>";
}
#---- Group
SELECT
  GROUP_CONCAT(
    a.`id`,
    ".",
    a.`content`
  ) AS `options`
FROM
  `docs` a;
I use explode() + foreach() loop (content isn't allowed naturally to have "." in its text):
foreach (explode(",", $options) as $option) {
  $option = explode(".", $option); //[0]: id, [1]: content
  echo "<option value=\"{$option[0]}\">{$option[1]}</option>";
}
#---- HTML Rows
SELECT
  CONCAT("<option value=\"",a.`id`,"\">",a.`content`,"</option>") AS `option`
FROM
  `docs` a;
I apply html in query and then use while() loop:
while ($row = $rows->fetch()) {
  echo $row;
}
#---- HTML Group
SELECT
  GROUP_CONCAT("<option value=\"",a.`id`,"\">",a.`content`,"</option>" SEPARATOR "")
FROM
  `docs` a;
here everything is already made in query to just print:
echo $rows->fetch();
 
     
    