Web Hosting Geeks | Web Hosting Experts
Need help? Call us 1(866)TOP-HOST

14655 reviews 1734 hosting providers

Questions & Answers

Adding html and JavaScript to SQL DB

May 2, 2013 by darkshark
Hi there
I was wondering if it is possible to add html and JavaScript to an SQL Database and if so, how can I do it? Does anyone have any insight on this?

1 Answer

0 votes
May 2, 2013 by SmartHost
Yes HTML and JavaScript can be added to SQL database.
To connect to your database and perform data related actions, you need to use server side scripts, such as php, jsp, etc..
$db = mysqli_connect('yourhostname','yourusername','yourpassword','yourdbname');
$query = "SELECT * FROM `table1’;";
$result = mysqli_query($db, $query);
while($row = mysqli_fetch_assoc($result)) {
to insert new data to the database, you can  write an INSERT query and execute it.