I am getting ~ 2k cities name from my Database that I am storing in a session variable, then I am trying to convert my session variable into a javascript variable but my code seem to crash
Code for session variable
$sql = "SELECT nom FROM Villes ORDER BY nbSearch";
try
{ $resultat = $bd->Select($sql); }
catch(Exception $e)
{ echo $e->getMessage(); }
if(count($resultat) != 0)
$_SESSION['villeDB'] = $resultat;
echo count($resultat)."<br/>";
php to javascript
var availableTags = '<?php echo json_encode($_SESSION['villeDB']) ?>';
I need to store each city name into that kind of JavaScript var
var availableTags = [];