Jump to content

Archived

This topic is now archived and is closed to further replies.

michela

MySql newbie question

Recommended Posts

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

 

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

307552[/snapback]

 

Share this post


Link to post
Share on other sites

×

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.