Click here to Skip to main content
11,478,902 members (58,060 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: PHP MySQL
hi all,

I have the following code (part of it):

$query = "INSERT INTO eyfs_register (register_id, am, pm, student_info_id)
	  VALUES (:register_id, :am, :pm, :student_info_id)";
 
 $statement = $conn->prepare($query);
 //student details table

 $statement->bindValue(":register_id", $register_id);
 $statement->bindValue(":am", $am);
 $statement->bindValue(":pm", $pm);
 $statement->bindValue(":student_info_id", $student_info_id);
 
 $statement->execute();
 
 $conn->commit();
 

the student info id which is in bold, is not a user input within the form. it is displayed as text read from another table. the question is as seen as in this eyfs_register table a column with student_info_id exists and is a foreign key, i need a copy of the id to be inserted.


I know it cannot be passed through as a variable would be which is input in a form. How would i do it? it is just a simple row within the form :

echo "<td><h3>" . $row['student_info_id'] . "</h3></td>";
Posted 20-Apr-13 4:28am
Comments
Mohibur Rashid at 21-Apr-13 1:10am
   
You can put your student info id in hidden field and retrieve it with other user input

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 195
1 F-ES Sitecore 170
2 Frankie-C 120
3 OriginalGriff 105
4 DamithSL 95
0 Sergey Alexandrovich Kryukov 7,865
1 OriginalGriff 7,341
2 Sascha Lefèvre 3,059
3 Maciej Los 2,491
4 Richard Deeming 2,335


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 20 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100