Jump to content


Photo

MySql newbie question


  • Please log in to reply
2 replies to this topic

#1 michela

michela
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 17 October 2005 - 08:58 PM

Hello,
I have a student signup and order database where students can order text online. Once a student orders a specific text I want to set-up the database so that it cannot be ordered again.

How can I combine the student_id number (s13) and the order (s1) together and add that to a new table named orders which contains only one column called order?

Hope that makes sense.
thanks



#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 17 October 2005 - 09:11 PM


student
=======
id
name
etc...

text
====
id
name
etc...

orders (a student/text x-ref)
======
student_id
text_id


[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']select[/span] text_id from orders where student_id = # [!--sql2--][/div][!--sql3--] yields all of the student's orders.
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#3 michela

michela
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 20 October 2005 - 06:05 PM

hmmm not sure if that is what I'm looking for....

When the student registers they provide the student id. When they then login to place their order the order has the student name, student_id etc...they are directed to the course page where they select from a drop down the course name and binding type.

So from there I want to update a new table in the database called orders which contains one column named order that I want to hold the course name (which was selected from the dropdown box) and the student number.

What I want to do once I have that working is to prevent the same student id from ordering the same course



student
=======
id
name
etc...

text
====
id
name
etc...

orders (a student/text x-ref)
======
student_id
text_id


[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']select[/span] text_id from orders where student_id = # [!--sql2--][/div][!--sql3--] yields all of the student's orders.

View Post






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users