Jump to content

Just a bit of help please


Recommended Posts

Hi guys  :)

 

Basically i have designed a db and written the form , i have also started writing the code to pass the data from the form to the db with sql.

 

can  just show u my data base design so you can see what i am trying to do.

 

[u]STUDENT[/u]
Student_Id
Username
Password
Title
First name 
Sir name
Date of birth
Nationality
Telephone number
Emergency Telephone number
Email address
Address
Profession
Fax number
Years of English already studied:
Do you smoke
Special requirements

[u]
COURSE[/u]
Course_id
Course name:
Course start date:
Course end date:
Number of weeks:

[u]STUDENT/COURSE[/u]
Student_id
Course_id

[u]ACCOMODATION [/u]
Accommodation id 
Accommodation Description
Type of accommodation required:
Accommodation Start date:
Accommodation End date: 

[u]
STUDENT/ACCOMODATION [/u]
Accommodation id 
Student_id

[u]FLIGHT[/u]
Flight_id
Arrival flight no:
Departure flight no:
Arrival date:
Departure date:
Arrival time:
Departure time:
Arrival airport:
Departure airport:
Do you require a transfer from the airport to your accommodation?

[u]STUDENT/FLIGHT[/u]
Flight_id
Student_id 

[u]
PAYMENT[/u]

Payment_id
Deposit_or_full 
Payment_type
Card_type
Cardholders_name
Cardholders_address
Card number
Security_number
Expiry_date

[u]PAYMENT/STUDENT[/u]

Payment_id
Student_id

 

 

Ok so now you see the db design i have started coding the sql to get the data from the form to the db.

 

heres a snippet.

// Variable for Student details part of form 
$title=mysql_real_escape_string($_POST['title']);
$First_name=mysql_real_escape_string($_POST['First_name']);
$username=mysql_real_escape_string($_POST['username']);
$Second_name=mysql_real_escape_string($_POST['Second_name']);
$password=mysql_real_escape_string($_POST['password']);
$DOB=mysql_real_escape_string($_POST['DOB']);
$Nationality=mysql_real_escape_string($_POST['Nationality']);
$Tel=mysql_real_escape_string($_POST['Tel']);
$emergency_tel=mysql_real_escape_string($_POST['emergency_tel']);
$email=mysql_real_escape_string($_POST['email']);
$address=mysql_real_escape_string($_POST['address']);
$Proffesion=mysql_real_escape_string($_POST['Proffesion']);
$faxnumber=mysql_real_escape_string($_POST['faxnumber']);
$number_years=mysql_real_escape_string($_POST['years_of_study']);
$smoke=mysql_real_escape_string($_POST['Smoke']);
$Special_requirements=mysql_real_escape_string($_POST['Special_requirements']);
// End of Variables for Student details 

// Sql Query sends all data from the form into the student table 
$student_details="INSERT INTO Student (Title,	First_Name,Username,Surname,Password,Dob,Nationality,Telephone_number,Emergency_number,Email,Address,Proffesion,Years_of_english_already_studied,Smoker,Special_requirements,Fax_number) VALUES ('$title','$First_name','$username','$Second_name','$password','$DOB','$Nationality','$Tel','$emergency_tel','$email','$address','$Proffesion','$number_years','$smoke','$Special_requirements','$faxnumber')"; 
//end of query one 

//******************execute sql statements******************************* //

//Execute sql statement 1
if (!mysql_query($student_details,$conn)) {
	die('Error: ' . mysql_error());

 

 

my question is, for example how do i insert data in to for example the

STUDENT/COURSE
Student_id
Course_id

 

so it all links up. 

Do i literally just do an insert into statement, could someone please give me an example please.

obviously this is a linker table, so i can find out what student is on what course etc. just wanna know how to actually send the data there?

 

as you can see also the student_id automatically gets written to the student table in the code above, how do i send that to the student/course table as well.

 

sorry if i dont make sense i am trying lol.

 

 

Link to comment
https://forums.phpfreaks.com/topic/106426-just-a-bit-of-help-please/
Share on other sites

Archived

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

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