/* Check to make sure we are connected to the database before allowing access to the home page. If not connected, go connect and initialize; otherwise, welcome the user.\ */ if(!database.connected()) redirect("init.htm"); idcursor = database.cursor("select rel_id from dep_rel order by rel_id"); while (idcursor.next()) { client.last_id = idcursor.rel_id; } client.new_id = parseInt(client.last_id,10); client.new_id++; project.lock(); database.execute("insert into dep_rel (rel_id, rel_descp) values (" + client.new_id + ", '" + request.descp + "')"); project.unlock(); redirect("relation.htm")