I am trying to output the array values into the console but I get an undefined error:
ERROR
ReferenceError: Ciencia is not defined
CODE
$sql = "SELECT topic FROM book_list WHERE topic != '' ORDER BY topic ASC";
$result = mysqli_query($db, $sql);
<?php
while($topic = mysqli_fetch_assoc($result)){?>
console.log(<?php echo $topic['topic']; ?>);
<?php }?>
If I output the sql in the mysql console I get this
+-------------+
| topic |
+-------------+
| Ciencia |
| Comedia |
| Comedia |
| Matematicas |
| Science |
+-------------+
Thanks!