Just trying to get the result of query to the javascript array or something.
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<title>Admin check</title>
<meta charset="UTF-8">
</head>
<body>
<script type='text/javascript'>
<?php
include 'pdo_connect.php';
function pleaseWork() {
return dataQuery("SELECT * FROM `grupy`")->fetchAll();
}
$work = pleaseWork();
echo "jArray = JSON.parse(<?php echo JSON_encode($work);?>);";
?>
</script>
Got code like that and there is the result:
<br />
<b>Notice</b>: Array to string conversion in <b>/virtual/chemioterapia2137.cba.pl/adminCheck.php</b> on line <b>20</b><br />
jArray = JSON.parse(<?php echo JSON_encode(Array);?>); //jArray = JSON.parse('');
How can I get it working?