SQL query using ajax only and display in html page - html

I'm having a table product in the database pascal, I'm using Mysql (Xampp) to store the database. I want to "Select * from product". I want to have ajax script that can query the sql statement and display it on a html page. I dont want to have any .php files. Can someone help me.. Thank you.

I don't think that's possible.
AJAX queries send XmlHttpRequests -- basically, messages over the HTTP protocol. And MySQL does not respond to HTTP queries. That's why you need something in-between -- PHP code would receive the HTTP message, perform the SQL operation, and return the results.
The second problem you have is that having a database which can be accessed from JavaScript is absolutely not secure. It implies that the username and password used to access it are stored in your code (which anyone can see), and it implies that it accepts connections from any source, since your JavaScript code would run on anyone's computer who is visiting the page.

Related

How can be done a SQL query which is not implemented inside the browser interface?

With the rise of home office I have to went and do all class of stuff via a web interface inside a database, the problem is that the developer did not add a field or page to formulate a custom sql query.
I understand that the php query parser its on files located in the server side (process.php and all that) so these cant be modified (and I dont intent to do that). The idea is to view/know how many fields are inside a certain database, since the work requires the existence of 2 specific fields that via the web interface does not seem to appear, and to know if these fields exists or not, so the data can be inserted in an accord format (and to request to the developer add it).
I have the legit access to the server, so how can the sql query be piped directly to the server outside the web interface?, or, since Im a valid user, a terminal session can be launched to check the structure?
The developer team is not responding, and left us with some issues,but this is the most needed.
Web server: Apache (dont know the version but guessing its from the
last 2.4.4x branches)
Server: Some flavor of linux.
SQL :Postgresql 11.x/12.x (but not sure, it can be mysql)
Thanks.

Create a simple registration system using only HTML and MySql

Is it possible to create a simple registration system with HTML,CSS and MySql without using PHP?
HTML, and CSS would typically generate client content while MySql is in most cases quite server specific. php is most of the time used as a server-side language.
So what actually is happening when you for example post from a form in your html it will generate a request sent to the server where it is evaluated and a response is likely.
So in HTML you would typically set up your form and tell it an action to take (a script on the server to run), this server-script could typically be written in any language, but let's keep on topic and assume the server script is in php. (example of other popular server-side scripts would be ruby on rails, python, lua to name a few).
How it is typically used then is for php to do the query on the database and all of this is on the server and the client know nothing at all about it. A result is generated and returned to the client if it should do so.
So no, it is not possible to use client-side to access a database on the server, if I interpret the question correctly. Hope it helps to clarify the concepts somewhat.
No you cannot do with only html and sql. You will require php in order to connect to database.
Html will be used to display values coming from database. Css can be used for styling elements on page.

Modify a HTML5 page without a server side page

I have a editable html5 page and I store new elements in localStorage.
I want to synchronize my page with the server.
I want to know if I can do it without a server side script or if there is some tips to do something like this in a good way.
Thank you :)
You can pull information from the server quite easily using jQuery and then just put it on Local Storage but, if you want to upload local information to the server there is no way around, you have to use some kind of script, tough it's not that difficult, there are many languages (PHP, C#, Python...) and tools you can use.
Keep in mind that when you upload information to the server you have to sanitize it very important security measure.
Basically, the way to go is:
Post the information to the server (using AJAX or a HTML form, either way will do)
Use some server-side script to capture the variables posted.
Sanitize your data (check format, discard non-valid characters, etc)
Store it on database (Do not, ever, concatenate your data with a SQL query ok? that can make you vulnerable to a SQL injection attack), compute something or do stuff.
Return some status to the client (some confirmation maybe?)
You may want to take that confirmation and show a message to the user ("Your info was saved properly" or something like that)
is a javascript timer not sufficient for this manner? or jQuery?
The question really should be more of a problem than a question. If you're updating based on a server's variables then you could use AJAX i believe but if its like increment said variable every X seconds I would focus on using a javascript timer.

On html how to you increase var by one and save it

I have taken Web Design, but I never learned how to take a variable on a website and each time someone clicks on it to increase by one and save it so the next user will see var+1.
For example how facebook liking works
This is not a simple task done by HTML only.
You'll need a database to store the number of likes. Other technologies like PHP and Ajax should also be used. This post gives you a little explanation on how to implement such a system.
You need a database in the server, and use JavaScript to  POST an Ajax query to server, and on page request you'd need a server side scripting language (e.g. PHP) to query the database for the value of the variable and generate a HTML page with that value. It's not possible to do it with pure HTML.

Online Status Report of a FTP Server?

I want to make a status report of when my FTP server is on and when its off. HTML is the language which I prefer to use. I have never used HTML before, and I need it due to a large request of when my ftp server is off and when its on.
If I were doing this, I would write an ASPNET page (or PHP, or etc) that simply connects and authenticates to the FTP server. If this succeeds, the server is online. The ASPX logic would then generate an HTML page indicating the results.
In the simple case you connect to the FTP server with each request for the page. It should cache the result though, and only check every minute, or five minutes, or some longer interval, regardless of how often a request for the status is made.
May i suggest instead of writing your own, you just install server monitoring tools on your server instead? It might be an easier choice that writing your own.
Google search
HTML is a static markup language. You might want need to use a server-side script like PHP or Perl to query for the FTP server status.