|
OK, I have made the two tables, here is the sql dump file
/*
MySQL Data Transfer
Source Host: 192.168.0.44
Source Database: vnu
Target Host: 192.168.0.44
Target Database: vnu
Date: 16/09/2008 00:22:40
*/ SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for test
-- ----------------------------
CREATE TABLE `test` (
`test_id` int(11) NOT NULL auto_increment,
`nameid` int(11) NOT NULL,
`firstname` varchar(25) NOT NULL,
`surname` varchar(25) NOT NULL,
`address` varchar(50) NOT NULL,
`postcode` varchar(11) NOT NULL,
PRIMARY KEY (`test_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ----------------------------
-- Table structure for venue
-- ----------------------------
CREATE TABLE `venue` (
`venueid` int(11) NOT NULL auto_increment,
`venue_name` varchar(25) NOT NULL,
`admin_id` int(11) NOT NULL,
`other info` mediumtext,
PRIMARY KEY (`venueid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- ----------------------------
-- Records
-- ----------------------------
INSERT INTO `test` VALUES ('1', '2', 'John', 'Jones', '2 Last post lane', 'bs82lr');
INSERT INTO `test` VALUES ('2', '2', 'Jenny', 'Smith', '12 watling road', 'dh75rp');
INSERT INTO `test` VALUES ('3', '1', 'david', 'grimsdyke', '1 askey rise', 'ls5 5opp');
INSERT INTO `test` VALUES ('4', '1', 'tim', 'burton', '3 sleepy hollow', 'lost head');
INSERT INTO `test` VALUES ('5', '3', 'J', 'Depp', 'Wonkaland', 'wi33');
INSERT INTO `test` VALUES ('6', '1', 'susan', 'sarandon', '2 robbins row', 'la');
INSERT INTO `venue` VALUES ('1', 'Arena', '17', 'Newcastle Metro Arena');
INSERT INTO `venue` VALUES ('2', 'City Hall', '12', 'Newcastle City Hall, Northumberland Street');
INSERT INTO `venue` VALUES ('3', 'Gala', '11', 'Durham Gala theatre');
Each table has an auto increment primary key and nameid is the foreign key to link to the venue table Now set up PHPrunner to connect to the database called VNU as I have called it that.
On the datasource tables page, select the table called test, put a tick next to it
On the right of the page, select Venue as the master table and venueid as the primary Key, the detail table will be test and select nameid as the foreign key display the master table info on the detail page should be ticked.
In the tables pane, tick venue as well. Build the project and you will find that you only see the test records that apply to the venue details when you click the link from the Venue page .
Just try it and see, you will be surprised how little coding is needed. just make sure that venueid and nameid ate the same data type and length. When you have records in the tables, you will see links next to them to the detail pages.
When you view the venue list page, you will see a link next to each record called test, this will take you to the detail records JUST for that master record.
Hover over the link and see a preview of all the records in the detail table that relate to the record in the main table.
Good innit?
Have I answered your problem?
Yes this is great - however i know how to do this but i want to display info from 3 or 4 other tables on the same page as the record im viewing. - ie i want to see info from the venue table then also display data from test table, reviews table, djs table etc? make sense? - i dont want to have to click through to see the info - i want all 4 tables showing on one page... this is why i thought i had to use custom code???? sorry if i have explained this totally wrong?
|