Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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;

}

share|improve this question
    
What is the real problem ? –  DontVoteMeDown 16 hours ago
    
It takes in the input from user but, I can't tell if it gets to the query. If it does, it doesn't return anything into the table. –  user3374835 16 hours ago
    
Did you debugged it? Did you know how to debug? –  DontVoteMeDown 15 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.