0

I am using the amCharts javascript library to show some data charts in my website. I want to read the data that will be in the charts from a database.

I'm reading the data with and after that making a call to the javascript function like this:

<?php
    echo '<script language="javascript">makeGraph(' . json_encode($data) . ')</script>';
?>

I am getting the results I want this way, but if a client look in the source code of the website, he will see all the data from the database instead of $data since you are not in the server anymore.

So the question is: how can I read and use all the data without exposing it publicly? Because I can not really figure out any other way to do it now.

Thank you very much

1
  • try using node.js. any client-side javascript will be readable because thats how javascript is by nature. Commented Aug 27, 2013 at 18:26

1 Answer 1

1

If you don't want users to see your data, then don't use JavaScript to process it. Create the charts in php on your server and display the results only.

Sign up to request clarification or add additional context in comments.

2 Comments

Is there any way to create the chart in PHP using a Javascript library like amCharts or HighCharts? If not, any recommendation of something like these libraries but in PHP?
No because the Javascript is run in the browser and PHP is run on the server. So you will have to find one, I have not used these libraries presonally so I cannot make any recommendations. duckduckgo.com/?q=php+charts

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.