rajeshatbuzz Posted July 11, 2011 Share Posted July 11, 2011 Hi Friends, I am looking for sample php program which can illustrate 2 mysql tables (one can act as foreign key for other table) and 2 forms and inserting/displaying both tables in which primary key and foreign usage has been illustrated nicely. I search on google but no success till now.. for example Form 1 (table 1) - Person table PID | Name | Age | Address | City for example Form 2 (table 2) - Qualification table ID | QUALIFICATION | College | University | PersonID( foreign key of PID) Looking for sample code. any help? Link to comment https://forums.phpfreaks.com/topic/241699-need-php-code-sample-program/ Share on other sites More sharing options...
IrOnMaSk Posted July 13, 2011 Share Posted July 13, 2011 all i can get out of what you're trying to do is creating two tables with one attribute is the foreign key of the other... to do that no php require just mysql create statement... of you can use phpmyadmin: www.phpmyadmin.net/home_page/downloads.php so here's how to do that table 1(Person): CREATE TABLE Person ( PID int not nul, Name varchar(30), Age int, Address varchar(60), City varchar(30), Primary Key(PID) ); Here's table number 2 (Qualification): CREATE TABLE Qualification ( ID int, Qualification varchar(30), College varchar(30), University varchar(30), PersonID int FOREIGN KEY (PersonID) REFERENCED Person (PID) ); inserting/displaying both tables in which primary key and foreign usage has been illustrated nicely. have no idea what you mean by that Link to comment https://forums.phpfreaks.com/topic/241699-need-php-code-sample-program/#findComment-1242466 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.