michela Posted October 17, 2005 Share Posted October 17, 2005 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 Quote Link to comment https://forums.phpfreaks.com/topic/2681-mysql-newbie-question/ Share on other sites More sharing options...
effigy Posted October 17, 2005 Share Posted October 17, 2005 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. Quote Link to comment https://forums.phpfreaks.com/topic/2681-mysql-newbie-question/#findComment-8913 Share on other sites More sharing options...
michela Posted October 20, 2005 Author Share Posted October 20, 2005 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] Quote Link to comment https://forums.phpfreaks.com/topic/2681-mysql-newbie-question/#findComment-9016 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.