Jump to content

Toolmaster

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Toolmaster's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I know this thread is probably old, but I need help with Auto Increment. This is the table I have created with auto_increment: CREATE TABLE appointment(appointment_id MEDIUMINT NOT NULL AUTO_INCREMENT, Primary Key (appointment_id), student_id varchar(8), INDEX (student_id), FOREIGN KEY (student_id) REFERENCES student(student_id), lecturer_name varchar(50), INDEX (lecturer_name), FOREIGN KEY (lecturer_name) REFERENCES lecturer(lecturer_name), appointment_date DATE, appointment_time TIME) TYPE=INNODB; Is the auto increment value also set as a primary key through Primary Key (appointment_id) or does it overide the primary key and its rules?
  2. What I want is when I insert a value in the foreign key attribute (username) within the lecturer_login table, it will look at the lecturer table to see if the lecturer_id inserted in the foreign key attribute is existing. If it is existing then users will be signed in providing their password is correct, if not then they will obviously recieve notification of their login being unsuccessful.
  3. This is a continuation thread from another thread I created in the PHP help forum.... http://www.phpfreaks.com/forums/index.php/topic,179558.msg801064.html#msg801064 Any ideas what the problem could be?
  4. What is the best version to use?
  5. I'm not familiar with it no, I am not a frequent PHP and Mysql coder, but I need to learn if i'm ever going to get a job that would interest me.
  6. What I have done is just create the tables, no data has been inserted in the tables as of yet. Now, when I go onto a front end interface of mysql and I type "DESC lecturer_login" there are only two attributes visible, one is the login_id (pk) and the other is the password attribute. The foreign key named username, which references from the lecturer table "lecturer_id" does not appear. ???
  7. Basically the situation is this, whenever I want to have a foreign key in the tables, whenever I look into those tables to see the attributes inserted, the foreign keys do not show up.
  8. Hello everyone, I have a problem with a foreign key in one of my tables, I am creating an online booking system for my university and so far I have created two tables: 1. Lecturer table, 2. Lecturer_Login table This is what I am confused with, below is some coding which i've used to create the two tables: LECTURER TABLE $sql = 'CREATE TABLE Lecturer( lecturer_id VARCHAR(9) PRIMARY KEY, name Varchar(50) NOT NULL, FOREIGN KEY (office_id) REFERENCES office (office_id), mob_tel_no INTEGER, email_address Varchar(50))'; LECTURER LOGIN TABLE $sql = 'CREATE TABLE lecturer_Login (login_id VARCHAR(6) PRIMARY KEY, FOREIGN KEY (username) REFERENCES lecturer(lecturer_id), passwrd VARCHAR(15) NOT NULL)'; The foreign key "username" is not shown when I query for the description of the table, I don't know why and what I can do about it. ??? ??? Any ideas?
  9. Hi guys back again with more problems. I would like to store a collection of variables into one whole variable. This code below shows drop down boxes, which contain the days, months and years. I would like to store this information into one variable, how would I do this? For example if the user selects 02, March, 2007 then I would like this information to be stored into the database. How can I store each value in the seperate drop down lists into one whole variable? Would appreciate the help, thanks. <?php /* create form containing date selection list */ echo "<form action=’processform.php’ method=’POST’>\n"; /* build selection list for the day */ $todayDay= date("d",$today); //get the day from $today echo "<p>Please select a date: \n"; echo "<select name=’dateDay’>\n"; for ($n=1;$n<=31;$n++) { echo " <option value=$n"; if ($todayDay == $n ) { echo " selected"; } echo "> $n\n"; } echo "</select>\n"; /* build selection list for the month */ $todayMO = date("m",$today); //get the month from $today echo "<select name=’dateMO’>\n"; for ($n=$todayMO+0;$n<=$todayMO+1;$n++) { echo "<option value=$n\n"; if ($todayMO == $n) {echo " selected"; } echo "> $monthName[$n]\n"; } echo "</select>"; /* build selection list for the year */ $startYr = date("Y", $today); //get the year from $today echo "<select name=’dateYr’>\n"; for ($n=$startYr;$n<=$startYr+1;$n++) { echo " <option value=$n"; if ($startYr == $n ) { echo " selected"; } echo "> $n\n"; } echo "</select>\n"; echo $appointment_date = 'dateDay', 'dateMO', 'dateYr'; (i've attempted it this way, but it doesn't work. ) echo "</form>\n"; ?>
  10. Is there a way to do it without using such an array? I mean it is all well and good as it looks to be the easy way of doing it, but is there a way that it can be done so that I won't need to keep changing the day numbers every year? Thanks for your help look forward to reading your response Tim
  11. Hi guys new to the forum, glad to be here among all you PHP experts! Anyway I have a problem in php, I have three drop down list boxes for users to select a day/month they want. <?php /* Program name: dateSelect.php * Description: Program displays a selection list that * customers can use to select a date. */ echo "<html> <head><title>Select a date</title></head> <body>"; /* create an array of months*/ $monthName = array(1=> "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); $today = time(); //stores today’s date $f_today = date("M-d-Y",$today); //formats today’s date echo "<div align=’center’>\n"; /* display today’s date */ echo "<p> <h3>Today is $f_today</h3><hr>\n"; /* create form containing date selection list */ echo "<form action=’processform.php’ method=’POST’>\n"; /* build selection list for the month */ $todayMO = date("m",$today); //get the month from $today echo "<select name=’dateMO’>\n"; for ($n=1;$n<=12;$n++) { echo "<option value=$n\n"; if ($todayMO == $n) {echo " selected"; } echo "> $monthName[$n]\n"; } echo "</select>"; /* build selection list for the day */ $todayDay= date("d",$today); //get the day from $today echo "<select name=’dateDay’>\n"; for ($n=1;$n<=31;$n++) { echo " <option value=$n"; if ($todayDay == $n ) { echo " selected"; } echo "> $n\n"; } echo "</select>\n"; /* build selection list for the year */ $startYr = date("Y", $today); //get the year from $today echo "<select name=’dateYr’>\n"; for ($n=$startYr;$n<=$startYr+3;$n++) { echo " <option value=$n"; if ($startYr == $n ) { echo " selected"; } echo "> $n\n"; } echo "</select>\n"; echo "</form>\n"; ?> (code obtained from PHP and MYSQL for Dummies) I have created an array to insert all the months of the year, and I have stored today's date on there so that each day it changes every 24hours. I would like to get help with a formula that would enable the user to only select the current date and any remaining days after in one particular month. So for example, today is the 23rd March, so I will be able to select 23rd or up to 31st March (31 days in March), but no date before 23rd. If a user selects another month, so instead of March they choose April, then the days that will appear will be dependant on how many days there are in April. (30 days in April). Anyone of you smart intellectuals got any ideas?
×
×
  • 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.