FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Insert Dropdown selected value as an individual row in MySQL





AnnuN
I want to Add Student information in multiple tables at one go using on form.

What I am doing is when I submit the form first I am populating the following table and get the last insert id which is an Autoincrement integer using this code
Code:
$last_student_id = $sql_op->insert_id;


The information stored in main table is like this (Precise with some fileds)



Then I want to store the students previous examination results in the following table as individual row



In last Student Courses he selects in the session or degree he is admitted in as individual table (Through 2 Dropdowns list 1st for Course1 and 2nd for Course2)


The form I am using is given below

AnnuN
Please help me in this regard
Marcuzzo
Hi,
you are a little vague on what the trouble is, I just can't get my head around it.

MySQL is easy, you can simply insert into any table.

what code do you have now?
AnnuN
Marcuzzo wrote:
Hi,
you are a little vague on what the trouble is, I just can't get my head around it.

MySQL is easy, you can simply insert into any table.

what code do you have now?


I want to record two courses one from each StudentCourse Dropdownlist and store it in StudentCourses table as two individual rows e.g.

Physics is the course with value 302
Maths is the course with value 303

Both should be store for example the StudentId is 21

Marcuzzo
AnnuN wrote:

I want to record two courses one from each StudentCourse Dropdownlist and store it in StudentCourses table as two individual rows e.g.

Physics is the course with value 302
Maths is the course with value 303

Both should be store for example the StudentId is 21


still not sure with which part you are having trouble with.

how about something like this:
Code:

'INSERT INTO StudentCourses ( StudentId, CourseCode) VALUES ( ' . $_POST["studentID"] . ', ' . $_POST["courseID_1"] . ');';
'INSERT INTO StudentCourses ( StudentId, CourseCode) VALUES ( ' . $_POST["studentID"] . ', ' . $_POST["courseID_2"] . ');';
Related topics
script backup database
Defalut Value in MySql
Fedora Core 5 Test 1 Review
NEED HELP IN VIEWS AND TRIGGERS
PHP Dropdown Selection
Forum Redirection Question
Javascript and Dynamic Select Boxes
Inserting PHP multidimensional arrays into a mySQL database
I could use some help with dropdown lists in php
set selected value in drop down
Updating multiple MySQL rows at once
oracle sql Alter table from a triggered package procedure
Adding Categories
Cannot insert data with single quote (Solved by Sonam)
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.