I know how to pass a PHP variable into JavaScript variable one by one, but now I wish to pass a bunch of variable in a For loop and I just stuck.
<?php
$m = new MongoClient();
$db = $m->data_from_tweeter;
$collection = $db->output;
$cursor = $collection->find();
foreach($cursor as $document){
echo $document['place'] ;
echo $document['fir'];
echo $document['sec'];
}
?>
I want to store 'place' as a String variable, 'fir' and 'sec' as two Num variables, and make them look like:
var num_1 {
some_place : some_fir,
some_place : some_fir,
some_place : some_fir,
....
}
and
var num_2 {
some_place : some_sec,
some_place : some_sec,
some_place : some_sec,
....
}
How can I make it? Thanks in advance!