i am trying to create a form in website and display the contents in another website. how do I retrieve data from a sql table a and add it to the website. which is better to use php or js
I tried using JS but its not working like I want it to
i am trying to create a form in website and display the contents in another website. how do I retrieve data from a sql table a and add it to the website. which is better to use php or js
I tried using JS but its not working like I want it to
2
Answers
Do not use js for database connection its insecure and you are putting yourself at risk of sql injections or someone gaining unauthorized access to your database, always use php. it has libaries like mysqli or PDO used for database operations.
To retrieve data from an SQL table and display it on a website, you can use either PHP or JavaScript, but they serve different purposes in this context.
PHP is a server-side scripting language, and it is commonly used for server-side operations like interacting with databases.
You can use PHP to connect to your database, retrieve data from the SQL table, and then generate HTML to display that data on your website.