JavaScript dygraph php dynamically generate content from database

I am using Dygraph to display a graph. I have it working statically like this

<div id="graphdiv"></div>
<script type="text/javascript">
  g = new Dygraph(

    // containing div
    document.getElementById("graphdiv"),

    // CSV 
    "Date,High,Low\n" +
    "2015-05-07,75,40\n" +
    "2015-05-08,70,50\n" +
    "2015-05-09,80,60\n" +
"2015-05-10,60,40\n" +
 "2015-05-11,50,30\n" +
"2015-05-12,0,0\n"

  );

</script>

Now I want to use PHP to dynamically generate the content from a database. I have tried to do it like this. I create the associative array to get the information from the database and then add php bindings to

    <?php
//CREATE SQL STATEMENT
$sql_temperatures = "SELECT * FROM tbltemperatures";

//CONNECT TO MYSQL SERVER
require('inc-conndygraph.php');

//EXECUTE SQL STATEMENT
$rs_temperatures = mysqli_query($vconndygraph, $sql_temperatures);

//CREATE AN ASSOCIATIVE ARRAY
$rs_temperatures_rows = mysqli_fetch_assoc($rs_temperatures);

?>
<!doctype html>
<html>
<head>

<!-- LINK TO THE DYGRAPH LIBRARY -->
<script type="text/javascript" src="dygraph-combined-dev.js"></script>

</head>
<body>

<!-- CONTAINER HOLDING GRAPH -->
<div id="graphdiv"></div>

<script type="text/javascript">
  g = new Dygraph(

    // containing div
    document.getElementById("graphdiv"),

"Date,High,Low\n" +
    // CSV 
    <?php do { ?>

    "<?php echo json_encode($rs_temperatures_rows['tdate']); ?>,<?php echo json_encode($rs_temperatures_rows['thigh']); ?>,<?php echo json_encode($rs_temperatures_rows['tlow']); ?>\n"

    <?php } while ($rs_temperatures_rows = mysqli_fetch_assoc($rs_temperatures)); ?>

  );
</script>

In theory, this should work in the function, however when I try to view it in any browser it will not display. Is there something stupid that I am missing?

I was thinking I may have concatenated incorrectly and it is displaying just not returning? I am not good at javascript and any help on this would be greatly appreciated.

Answer:1

So I update my state in a component and then pass the new props into the child but the child isn't updating correctly and the defaultValue of the input is not changing. At first I thought it might be ...

So I update my state in a component and then pass the new props into the child but the child isn't updating correctly and the defaultValue of the input is not changing. At first I thought it might be ...

  1. react passing props to parent
  2. react passing props to props.children
  3. react passing props from parent to child
  4. react passing props to function
  5. react passing props through route
  6. react passing props down
  7. react passing props to state
  8. react passing props spread operator
  9. react passing props to grandchildren
  10. react passing props to grandchild
  11. react passing props to child components
  12. react passing props with same name
  13. react passing props up
  14. react passing props to this.props.children
  15. react passing props without value

I have been reading about AMD and implementations like requirejs. Most of the resources covers the usage and API's. But, when it comes to implementing this, how can you load a JavaScript file into a ...

I have been reading about AMD and implementations like requirejs. Most of the resources covers the usage and API's. But, when it comes to implementing this, how can you load a JavaScript file into a ...

i m trying to remove tr from table using closest function. this function is working properly out of the $.post request but when same script is used in post request its not working. My Code is $("....

i m trying to remove tr from table using closest function. this function is working properly out of the $.post request but when same script is used in post request its not working. My Code is $("....

  1. didn't
  2. https://www.disneyplus.com/
  3. didn't i
  4. didn't i lyrics
  5. disney plus
  6. didn't i onerepublic
  7. didnt even notice
  8. didn't ask
  9. disney store
  10. disney world
  11. disneyland
  12. didn't synonym
  13. didn't ask meme
  14. disneyland tickets
  15. disney +
  16. didn't know i was pregnant
  17. didn't detect another display
  18. didn't cha know
  19. disney cruise
  20. disney movies

I have an input field where I expect users to type text that contains 1 of many keywords that will trigger different audio files depending on the keyword. (I know that's not really smart from UX point ...

I have an input field where I expect users to type text that contains 1 of many keywords that will trigger different audio files depending on the keyword. (I know that's not really smart from UX point ...