/* 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 note_id from hr_notes order by note_id"); while (idcursor.next()) { client.last_id = idcursor.note_id; } client.new_id = parseInt(client.last_id,10); client.new_id++; project.lock(); database.execute("insert into hr_notes (note_id, note) values (" + client.new_id + ", '" + request.note + "')"); project.unlock(); redirect("note.htm")