There is something wrong with the way I am printing MySQL and the javascript is not executing it. Here is an example.
square[1] = "asdfasdfadsf";
When I print "asdfasdfadsf" from my MySQL database, the javascript does not work. However, if I simply type "asdfasdfadsf" in the static HTML it executes fine. I have tried as many PHP functions and charset conversions as I can. Please Help!
I suggest the json_encode PHP function. Apart from properly printing the string, it also escapes all dangerous characters.
square[1] = <?php echo json_encode($my_string); ?>;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With