Jump to content

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

 

 

Link to comment
https://forums.phpfreaks.com/topic/2681-mysql-newbie-question/
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.

Link to comment
https://forums.phpfreaks.com/topic/2681-mysql-newbie-question/#findComment-8913
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]

 

Link to comment
https://forums.phpfreaks.com/topic/2681-mysql-newbie-question/#findComment-9016
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.