close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Premiere Ticket other Questions...

Thread began 8/31/2011 5:42 am by Sly Verano | Last modified 9/26/2011 10:51 am by Jason Byrnes | 1487 views | 9 replies |

Sly Verano

Premiere Ticket other Questions...

Hello,

I'm creating now the send a private message to users...

I just want to ask ... what is the format of the filter should I used in my record set. To view the messages that I owned. To avoid the viewing of other messages of the users. How was that?

Thanks ... :)

Sign in to reply to this post

Jason ByrnesWebAssist

when you log in a session variable is created with your users ID number, use that session variable to filter the messages on the User ID column of your messages table.

Sign in to reply to this post

Sly Verano

Professor will create the class page for their student

Thanks Jason. It works. I already have my sentbox features at my webpages. Your Very

Genius.
---------------------------------------------------------------------------------------

I have my another question regarding to my comment system.

Now I want the comment system is inside of the classpage.php of what the professors created ...

What is my first step to implement this feature ?

1.) How can the professor create a new classpage.php, for me to able to add the comment system inside that classpage.php.

2.) After the professor created the classpage.php, How could the professor add a student to that classpage.php ?

3.) How could the student join to that classpage.php ?

Thanks in Advanced Jason ...

Sign in to reply to this post

Jason ByrnesWebAssist

  1.) How can the professor create a new classpage.php, for me to able to add the comment system inside that classpage.php.  



you dont create a new physical file. On the classpage.php file, you create a recordset to look up the class by ID.

you would have one page that listed all of the classes with a link top the classpage.php file, that passes a querystring variable. The technique is reffered to as a master details page set:
WScbb6b82af5544594822510a94ae8d65-78b7a.html

  2.) After the professor created the classpage.php, How could the professor add a student to that classpage.php ?

3.) How could the student join to that classpage.php ?  



I think you are missing some basic MySQL relational data concepts that will be needed to get this working.

in a mysql database, all of your tables will have a primary key column.

for the classes table, there will be a primary key column that uniquely identifies the class.

for the student table, there will be an ID column that uniquely identifies the student.

In MySQL you use these ID values to create relationships between the data.

there are 2 basic types of relationships:
1) One to Many
2) Many to Many

One to many relationships are pretty easy, but many to many relationships are more difficult.

With assigning students to classes, you are talking about a many to many relationship.

the idea with a many to many relationship is to create a linking table.

for example, if you have a students table:

students:
studentID - Primary Key
studentName - text
etc...

and a classes table:
classID - Primary Key
className - text
etc

you would need to create a studentClasses linking table:

studentClasssID - Primary Key
studentClassStudentID - relates to students.studentID
studentClassClassID - Relates to classes.classID

for the professor to assign students to the class, you needs to create a page where the professor selects the student, then selects the class and inserts the student ID and the Class ID to the studentClass table.


for the student to sign up for a class, when they login, their ID will be stored in a session variable, you need to set up a page where the student selects the class, then ID session variable and the Class ID are stored to the studentClass table.

Sign in to reply to this post

Sly Verano

Thanks Jason for a very clear explanation.

  in a mysql database, all of your tables will have a primary key column.

for the classes table, there will be a primary key column that uniquely identifies the class.

for the student table, there will be an ID column that uniquely identifies the student.

In MySQL you use these ID values to create relationships between the data.  



In my class table I have 3 primary keys ... those are (PKsecSectionCode, PKsecSectionSchoolYear,PKsecSectionSemester) because in every school year and semester the SECTION CODE of the class is repeating. for example (the section code is:M001, SY is 2011-2012, let say the semester is 1st Semester) ...

and when the 1st Semester is already finished,.. there is a 2nd semester so (SECTION CODE is M001, SY is 2011-2012, SEMESTER IS "SECOND SEMESTER")

So to avoid the duplication of the Row I used multiple PRIMARY KEYS of the my Class table.

------------------------------------------------------------------------------

1.) Is my class table structure for my database is correct ? because this is my first time to used the MULTIPLE PRIMARY KEY in a table.


2.) Now I want to join this MULTIPLE PRIMARY KEY table to other tables ... can you help give me some PATTERNS AND HINTS in JOINING A TABLE (already have the relationship of my tables)
...
-------------------------------------------------------------

THANKS IN ADVANCED ... :)

Sign in to reply to this post

Jason ByrnesWebAssist

no, using multiple is not correct.

you should only have one Primary key column.

the primary key column should use an Integer as the data type, and it should be set to automatically increment.

the primary key column should be a numeric value that is controlled by the database.

The section, school year and semester columns can be indexes in the table, but they will not be the primary key.

the way I would create the table is:


classID - Primary Key, auto increment
classSection - text
classYear - text
classSemester

you will have records that look like this:

+---------+--------------+-------------+---------------+
| classID | classSection | classYear | classSemester |
+---------+--------------+-------------+---------------+
| 1 | M001 | 2001 - 2012 | First |
+---------+--------------+-------------+---------------+
| 2 | M001 | 2001 - 2012 | Second |
+---------+--------------+-------------+---------------+
| 3 | M001 | 2001 - 2012 | Third |
+---------+--------------+-------------+---------------+
| 4 | M001 | 2001 - 2012 | Fourth |
+---------+--------------+-------------+---------------+



the value to use to create the relationship to a first semester or third semester class would be the classID column.

I strongly suggest looking at your local bookstore for some books on MySQL database design.

Sign in to reply to this post

Sly Verano

Thank You very much Jason. Accept my humble gratitude to you. You always give me a

clear direction regarding my Capstone Project. :) I don't have any regret to join this

community. All the engineers in WA are very genius and very supportive to their fellow

customers. Keep it Up.

  The section, school year and semester columns can be indexes in the table, but they will not be the primary key.  



1.) So If I set the the section, school year and semester columns to indexes. What is the

purpose of that indexes.

  classID - Primary Key, auto increment
classSection - text
classYear - text
classSemester  



2.) If I set the datatype of the classSection,classYear,and classSemester to Datatype:TEXT and when I set it those column to index this error occur

ERROR: Error 1170: BLOB/TEXT column 'secSectionCode' used in key specification without a key length

3.) What can you suggest of datatype if I will set those column into Indexes.



-------------------------------------------------------
Thanks in Advanced Again ...

Sign in to reply to this post

Jason ByrnesWebAssist

You really need to do some reading on MySQL,

  1.) So If I set the the section, school year and semester columns to indexes. What is the

purpose of that indexes.  


see the following page on the MySQL Site for a description of indexes:
mysql-indexes.html

2- 3) The usual text data type to use is varchar

Sign in to reply to this post

Sly Verano

Hi Jason,

how can I joined these kind of relationship table ... I want the cloumn className to be part of my table studentSection. but when I joined the column className into the table studentSection. And put insert the rs_className into my page. there is no record appear when check into the browser.

  students:
studentID - Primary Key
studentName - text
etc...

class table: (parent)
classID - PRimary key
className - text
etc ...

and a section table:(child of class)
sectionID - Primary Key
sectionName - text
classSectionClassID - relates to class.classID
etc


studentSection(child of section table and student table) many to many relationship (but I want to joined the className column to my recordset to view the className of that section)

studentSectionID - Primary Key
studentSectionStudentID - relates to students.studentID
studentSectionSectionID - Relates to section.sectionID  



Advanced Thanks...

Sign in to reply to this post

Jason ByrnesWebAssist

when the class is inserted, a session variable is created that contains the class ID.


This session should be used in the section.classSectionClassID column when inserting the section record.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...