how can i connect HTML page to database? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

how can i connect HTML page to database?

describe me anybody that, how to insert data from HTML page to database...?

21st Apr 2018, 6:27 AM
Desh Deepak
Desh Deepak - avatar
5 Answers
+ 6
What do you mean by 'directly'? HTML is not a programming language, so it is not possible to connect to a database using only the markup language. You need another language that can establish a connection and get the results of the query you use. You can use Java, PHP, Javascript, Python, Ruby and basically just about any language.
21st Apr 2018, 7:01 AM
Mickel
Mickel - avatar
+ 3
You can not do it, for that you need a language that works on the server side.
21st Apr 2018, 6:49 AM
Mickel
Mickel - avatar
+ 2
Mickel Sánchez. like Servlet but, you have any other idea? directly interact to database...
21st Apr 2018, 6:56 AM
Desh Deepak
Desh Deepak - avatar
+ 1
okay you mean we can't connect to database without established connection between frontend and back backend. thanks for your answer...
21st Apr 2018, 7:10 AM
Desh Deepak
Desh Deepak - avatar
0
Use this PHP code.. save it as connection.php. For further information, contact me. <?php $con = mysql_connect(localhost,"root","") or die(mysql_error()); $db = mysql_select_db("Database name here",$con) or die(mysql_error()); function protect($string) { $string = mysql_real_escape_string($string); return $string; } ?>
26th Apr 2018, 7:38 PM
Muhammad Imtiaz Hussain
Muhammad Imtiaz Hussain - avatar