Jump to content

Viruthagiri

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Viruthagiri's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello friends, I have a table which contains file names. For example i have stored a file "java.pdf" in a directory called "course". The file is located here. http://www.something.com/course/java.pdf Now i stored the file name in a column named "document_filename". I stored it as "java.pdf" Now if a user click the course it should rediect to view the file. I coded like this. Please correct my code. <%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" %> <% try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost/elearning_datasource?user=root"); int course_id; String query,query1; course_id=Integer.parseInt(request.getParameter("course_id")); String statement="SELECT document_filename from x_masterlistofdocuments where course_id="+course_id+""; ResultSet objRs=null; response.sendRedirect("http://www.something.com/course/%=statement%"); con.close(); } catch(Exception e) { out.println("Error?"+e.getMessage()); } %> I understand the error is in this line: response.sendRedirect("http://www.something.com/course/%=statement%"); I want redirect to the file what is selected using query. Thankyou friends
  2. Guys i have three tables in my database. 1.x_masterlistofcourses 2.x_masterlistofpapers.3.x_masterlistofocuments x_masterlistofcourses structure: course_id course_name course_description x_masterlistofpapers structure: paper_id paper_no paper_name course_id paper_description dbase x_masterlistofdocuments structure: document_id paper_id paper_no document_name document_filename document_description In my front page I'm showing course name and description. The paper details for every course is stored in x_masterlistofpapers table. The documents for this papers is stored in x_masterlistofdocuments table. Now i want to get document name document description details details from database based on course_id and paper_id. Please any one solve my error. It is urgent. I written query as "select * from x_masterlistofdocuments d,x_masterlistofpapers p where p.course_id="+course_id+" group by d.paper_id=p.paper_id" What is wrong in my query. Bunch of thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.