I am trying to make a script within my HTML code. This script should connect to my database, store two variables ID and PID from a form in my HTML code. Once having these vales I will use them in a PostgreSQL query. I then need to get that result and put it into a in my table. Can anyone help me with my script? I am using Dreamweaver.
// Create connection
var conn = new ActiveXObject("ADODB.Connection") ;
var connectionstring="Data Source=host=::1;Initial Catalog=maintanenceDB;User ID=postgres;Password=3914krajewski;Provider=postgres";
conn.Open(connectionstring);
var rs = new ActiveXObject("ADODB.Recordset");
function query() {
var ID = document.getElementsByName("id");
var PID = document.getElementsByName("parent_id");
rs.Open("SELECT parentX.parent_link FROM master_ifis_network AS nodeX, master_ifis_network AS parentX WHERE (nodeX.left BETWEEN parentX.left AND parentX.right) AND nodeX.link_id = " + ID +" ORDER BY parentX.left DESC;", conn);
rs.MoveFirst
while(!rs.eof)
{
document.getElementById("nestP").defaultValue = rs.fields(1);
rs.movenext;
}
rs.close;
connection.close;
}