Adding html and JavaScript to SQL DB

asked May 2, 2013 in Database by darkshark (1,500 points)
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 like 0 dislike
answered May 2, 2013 by SmartHost (9,060 points)
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.