-1

So I created a web page with HTML5 and js. I'm trying to get some data from that web page and save it in a database made in MySQL. How is the best way to connect my web page with a database. I really dont know much about this, if is not possible, how does a normal web page where you fill a form works?, how do they get the data from the form? .

  • PHP backend is an option. Off topic to explain that here. I'm sure there are tons of tutorials online. – 001 Apr 28 '22 at 00:32
  • You need a backend program. You can use any programming language. Including JS or PHP. – Quentin Apr 28 '22 at 13:37

1 Answers1

-2

Directing from your HTML isn´t possible, you should use an api call or something that handles the connection... Look a similar questions and answer at Can JavaScript connect with MySQL?

  • I read that question but its from 2010 – ARTURO SANCHEZ SANCHEZ Apr 28 '22 at 00:40
  • continues that imposible, you must use a intermediate like node.js, also it´s not secure store the DB password flat on your js or html!! Here a [tutorial](https://www.mysqltutorial.org/mysql-nodejs/connect/) – Julio Améstica Apr 28 '22 at 00:59
  • okey thank you, but then how does a real web app works, how do they store their data? is not my intention to save the password in the js, i just wanna know how to create a web page that uses a db cause i really dont know how and im really lost – ARTURO SANCHEZ SANCHEZ Apr 28 '22 at 02:04
  • Generally front- end communicate with back-end api and it communicate with the database but depend of what technology you use!! What do you have in main – Julio Améstica Apr 28 '22 at 03:13
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 28 '22 at 08:06
  • i really just want to create something simple u know, something i can get practice with, learning on how to implement a database i think is important – ARTURO SANCHEZ SANCHEZ Apr 28 '22 at 13:33