my php sql query generates a quick rowset result in an associative array like this.
Expand|Select|Wrap|Line Numbers
- if ( $result = $db->query($sql) )
- {
- if ($result->num_rows > 0)
- {
- $f = mysqli_fetch_all( $result, $resulttype = MYSQLI_ASSOC );
- }
- }
Expand|Select|Wrap|Line Numbers
- <script type="text/javascript">
- var exportArray = <?php echo $f;?>;
- </script>
Is it only possible to copy this data using two loops. Where in outer loop you cycle through the php array. And in the inner loop you cycle through each column of that specific row?
What I was looking for was a better way.
When streaming out my page to the client computer, I was looking for a quick way to insert this data into a javaScript array on the resulting page web page. I was hoping not to have to loop through the php array and extract each column in each row.