You need a random sample of text from the database via javascript from the mysql database, without resorting to raising the server, followed by php.
Are there any standard features?
You need a random sample of text from the database via javascript from the mysql database, without resorting to raising the server, followed by php.
Are there any standard features?
made from comments.
There are 2 options that do not contradict the kiss :
If the questions will not change (or will rarely change), I would choose the second.
In the event that questions will be replenished - would write a server.
In general, from a security point of view, a direct connection to the database, to put it mildly, is not the best solution; moreover, there is simply no direct means for this.
In any case, MySQL will spin on the server, so there is a server. If you really want to stay in the framework of JS - Node.JS to help, twist on the server, let it execute requests and give answers in the same Json. Will shustrenko.
In this case, at least, it will not be necessary to store the login / password for the connection in all instances of the application.
The second option is SQLite. Local file on your smartphone, then create what you want. Updating the database of questions - downloading a new file.
In modern browsers, there is a noSQL database embedded . But with mysql without raising the server at least locally, you will not be able to do it in any way (node.js is also raising the server).
Without a server to make access to the database is not possible. JavaScript runs in the browser, the browser sends requests to the web server, the web server sends this request to an interpreter such as php (or any other server technology), and only after that in the server script you can contact the database. Then everything in the reverse order from the database returns the data to the script, from the script to the web server, from the web server to the browser. It is impossible to access the database via JS from the browser bypassing the server.
Source: https://ru.stackoverflow.com/questions/111716/
All Articles