I need to create an array in php and then to assign to java script function.I need something like this I need this array as same as it looks
$users = array(
array('username' => 'user1', 'email' => '[email protected]'),
array('username' => 'user2', 'email' => '[email protected]'),
array('username' => 'user3', 'email' => '[email protected]'),
...
);
For $users array i tried this code
$users = array();
while($rw = $objApp->dbrow($res))
{
$users []=array('username'=>$rw['username'],
'email'=>$rw['email']
);
}
Is this OK?
If yes then i want to pass the same array to javascript function...here is what i tried
objJS::importUsers( <?php echo json_encode($results) ?>);
This is simple,what is the issue in my code due to which it is not working
objJS::importUsers