Wrox Programmer Forums
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 2nd, 2009, 10:51 AM
Registered User
Join Date: Apr 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation linking tables

This is a student web organiser.
I really need help with this!!
Have THREE database tables
Field Type
CourseCode varchar(10)
Semester int(1)
CourseYear int(1)
Day varchar(10)
Time varchar(5)
Subject varchar(100)

username varchar(10)
day varchar(10)
Time varchar(10)
Subject varchar(100)
CourseCode varchar(10)
Semester int(1)

firstname varchar(15)
lastname varchar(20)
username varchar(15)
password varchar(20)
email varchar(20)
coursecode varchar(10)
courseyear int(1)

the user enters in all their details at regestration then they login into the system. I have all the seperate courses information in course info. The main aim of the program is to be able to make a unique timetable for each member. I want an php statment that transfers all the course info rows depending on what course and year the user picks during registration. However as there is no username in courseinfo and this is the unique idenitfier for the timetable and is necessary to extract it how will i do this???

not sure at all but something like
select username.userinfo , coursecode.userinfo , courseyear.userinfo , day.courseinfo , time.courseinfo, subject.courseinfo,
from userinfo and courseinfo
where username = (user that just registered) AND courseyear = (course that the user just entered) AND coursecode = (course code that user just entered)

and insert that select statement into the weeklytimetable table

is this possible or is there another way of doing it ?

example of tables
course info
course code-CA316, CA316
semester1, 1
courseyear 1, 1
time 09.00, 10.00

firstname - john, paul
lastname - brown, murphy
username - johnb, paulm
password - ****, ****
email - ifi@fd , ds@fjd
coursecode- ca136, ca136
courseyear - 1, 1

username - johnb, johnb
day -monday, tuesday
time -9.00, 10.00
subject -lecture, party
coursecode - ca316, ca316
semester -1, 1
courseyear -1, 1

many thanks for your help!its very urgent!!
Old April 3rd, 2009, 05:52 AM
Friend of Wrox
Join Date: Oct 2007
Posts: 130
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via AIM to urtrivedi

I think your table design is not normallised. Your weektable contains same columns as you course info table. define primary key in course info and refer that key in weektable.
weektable may look like

username, courseinfoid

Help yourself by helping someone.
Old March 4th, 2011, 06:35 AM
Friend of Wrox
Join Date: May 2005
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts

...is that all there is to it?

Internet has become favorable with that tool...thank you Tim Berners-Lee!

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking pivot tables iacon Excel VBA 3 July 24th, 2006 01:25 AM
Access2000 Linking Tables Rchanga Access 1 December 21st, 2004 05:49 PM
Linking Tables usedcarsgbcom Beginning PHP 4 November 23rd, 2004 08:46 PM
Prevent linking to tables MG76 Access 2 March 12th, 2004 02:29 PM
Linking Tables Con Access VBA 2 September 24th, 2003 04:32 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.