A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Pulling info from one table into another and more.....

  1. #1
    Senior Member
    Join Date
    Sep 2000
    Posts
    272

    Pulling info from one table into another and more.....

    Greetings all,

    I shall start with what my situation is before I explain what I want to do.

    Currently: I have a mysql database with one table in it which caputres the following info: StudentID and Module. It adds an autoincriment ID and date.

    Each time a student completes a module, it adds a line to the table mentioned above and there are multiple entries for each StudentID.

    What I want to do: I would like to capture each item for a particular StudentID into a different table and display that info on a webpage to show the student what they have already completed.

    Any assistance will be greatly appreicated.

  2. #2

  3. #3
    Senior Member
    Join Date
    Sep 2000
    Posts
    272

    Starting Point

    I am actually looking for a starting point. Any guidance would be appreciated.

    Thanx

  4. #4
    Official FK nice guy and MOD 3PRIMATES's Avatar
    Join Date
    Apr 2002
    Location
    Portland Oregon
    Posts
    1,645
    Hi there, there are many ways to do this. The two most obvious and simplest would be:

    Create a table studentData with a studentID field as Unique primary key
    In this table you would also add a row for each module.
    Dont hold the student module data in the main studentInfo table, but rather place that in studentData and find the user by the studentID key

    Or, in my opinion, a better option is:

    Create a table studentData
    Add fileds:
    studentID (varchar)
    studentModule (varchar)
    studentModuleStatus (tiny int) use boolean 0/1 for completed/inclomplete
    studentModuleDate(date)
    StudentModuleGrade (varchar or int depending on if its numerical graded or pass / fail)

    Each time a student starts a new module, a row is added to the studentData table using the studentID to identify the field as theirs.
    The other data like the module name and date are added at this time.

    If a student has completed many modules, there will be many rows in studentData for this student. Each row is for a different module.

    The nice thing about this type of system is that it allows the administrator
    to add module names whenever they want without having to change the database structure.

    When the data is retrieved, you would just query the records using the studentID to retrieve all modules that are asscoiated with the student.

    At this point you would output to the screen:
    (login and access studentRecord)
    (Get studentID from student record)
    (Query studentData with studentID to get records)
    (Output each record in a format)
    Module Name: some module
    Module Status: completed
    Module Last Accessed: date
    Module Grade: 70/100



    Hope that made sense.

    3P

  5. #5
    Senior Member
    Join Date
    Sep 2000
    Posts
    272

    Thanks

    3PRIMATES,

    Thanks for the reply. I am on the track you recommended. I am currently attempting to setup a query based on the studentID which is captured from the login.

    Would have any idea on what would be the best way to accomplish the query?

    Thanks

  6. #6
    Official FK nice guy and MOD 3PRIMATES's Avatar
    Join Date
    Apr 2002
    Location
    Portland Oregon
    Posts
    1,645
    Step1:
    User logs in with username and password
    query db -
    SELECT studentID FROM studentInfo WHERE username=posted username AND password = posted password

    On Failure - Incorrect login output/page

    STEP2:
    on success -
    SELECT * FROM studentData WHERE studentID=studentIDFromAboveQuery
    SORT BY SomeField

    On success - show records output

    On failure - no records for this student at this time

    Hope that helps.
    If you need help writing the querys just ask.

    3P
    Last edited by 3PRIMATES; 10-31-2007 at 06:42 PM.

  7. #7
    Senior Member
    Join Date
    Sep 2000
    Posts
    272

    Thanks

    3PRIMATES,

    That is a great help. Your assistance is greatly appreciated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center