View unanswered posts | View active topics It is currently Mon Jun 26, 2017 1:51 am



Reply to topic  [ 1 post ] 
 How to display records from multiple tables 
Author Message
Junior Member

Joined: Mon Jul 13, 2009 2:53 am
Posts: 1
Post How to display records from multiple tables
I have many tables in my MySql database.
I would like to display records from two tables in DESIRED SEQUENCE.
Here are structure and inserted data samples.

// * TABLE ONE
--
-- Table structure for table `mscdata`
--

CREATE TABLE IF NOT EXISTS `mscdata` (
`cdata_id` int(12) NOT NULL auto_increment,
`user_id` int(12) NOT NULL default '0',
`cfield_id` int(12) NOT NULL default '0',
`value` longtext NOT NULL,
PRIMARY KEY (`cdata_id`),
KEY `user_id` (`user_id`),
KEY `cfield_id` (`cfield_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=23 ;

--
-- Dumping data for table `mscdata`
--

INSERT INTO `mscdata` (`cdata_id`, `user_id`, `cfield_id`, `value`) VALUES
(1, 1, 1, 'Person one'),
(2, 1, 2, 'Person one address'),
(3, 1, 3, 'Person one location'),
(4, 1, 4, 'Person one Area'),
(5, 1, 5, 'Person one City'),
(6, 1, 6, 'Person one State'),
(7, 1, 7, 'Person one Country'),
(8, 1, 8, 'Person one Pincode'),
(9, 1, 9, 'Person one Telephone'),
(10, 1, 10, 'Person one Mobile'),
(11, 1, 11, 'Person one Category'),
(12, 2, 1, 'Person two'),
(13, 2, 2, 'Person two address'),
(14, 2, 3, 'Person two location'),
(15, 2, 4, 'Person two Area'),
(16, 2, 5, 'Person two City'),
(17, 2, 6, 'Person two State'),
(18, 2, 7, 'Person two Country'),
(19, 2, 8, 'Person two Pincode'),
(20, 2, 9, 'Person two Telephone'),
(21, 2, 10, 'Person two Mobile'),
(22, 2, 11, 'Person two Category'),
-- ------------------------------------------------------------------------------
// * TABLE TWO
--
-- Table structure for table `mscfields`
--

CREATE TABLE IF NOT EXISTS `mscfields` (
`cfields_id` int(12) NOT NULL auto_increment,
`field_type` varchar(16) NOT NULL default '',
`field_options` longtext,
`field_sname` varchar(16) default NULL,
`field_lname` varchar(64) default NULL,
`field_length` int(12) default '0',
`field_req` int(1) NOT NULL default '0',
`field_order` int(3) NOT NULL default '0',
PRIMARY KEY (`cfields_id`),
UNIQUE KEY `field_sname` (`field_sname`),
KEY `field_sname_2` (`field_sname`),
KEY `field_lname` (`field_lname`),
KEY `field_type` (`field_type`),
KEY `field_req` (`field_req`),
KEY `field_order` (`field_order`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ;

--
-- Dumping data for table `mscfields`
--

INSERT INTO `mscfields` (`cfields_id`, `field_type`, `field_options`, `field_sname`, `field_lname`, `field_length`, `field_req`, `field_order`) VALUES
(1, 'textbox', '', 'msfname', 'Full Name', 50, 0, 1),
(2, 'textbox', '', 'mshouse', 'House Address', 40, 0, 2),
(3, 'textbox', '', 'mslocation', 'Location Address', 60, 0, 3),
(4, 'textbox', '', 'msarea', 'Area / Suburban', 20, 0, 4),
(5, 'textbox', '', 'mscity', 'City / Town / Village', 20, 0, 5),
(6, 'textbox', '', 'msstate', 'State / Province', 20, 0, 6),
(7, 'textbox', '', 'mscountry', 'Country', 20, 0, 7),
(8, 'textbox', '', 'mspincode', 'Pin / Zip Code', 10, 0, 8),
(9, 'textbox', '', 'msphone', 'Telephone Number', 20, 0, 9),
(10, 'textbox', '', 'msmobile', 'Mobile Number', 20, 0, 10),
(11, 'textbox', '', 'mscategory', 'Category', 2, 0, 11);
-- ------------------------------------------------------------------------------
//* TABLE THREE
--
-- Table structure for table `msusers`
--

CREATE TABLE IF NOT EXISTS `msusers` (
`users_id` int(12) NOT NULL auto_increment,
`group_id` int(12) NOT NULL default '0',
`signup_date` bigint(64) NOT NULL default '0',
`firstname` varchar(32) default NULL,
`lastname` varchar(64) default NULL,
`email_address` varchar(128) NOT NULL default '',
PRIMARY KEY (`users_id`),
KEY `group_id` (`group_id`),
KEY `signup_date` (`signup_date`),
KEY `email_address` (`email_address`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Dumping data for table `msusers`
--

INSERT INTO `msusers` (`users_id`, `group_id`, `signup_date`, `firstname`, `lastname`, `email_address`) VALUES
(1, 1, 1192615679, 'Person one', '', 'personone@serviceprovider.com'),
(2, 1, 1193656518, 'Person two', '', 'persontwo@serviceprovider.com'),
-- ------------------------------------------------------------------------------
DESIRED RESULT SEQUENCE —

First name : Person one //* from table mscdata
Address : Person one address //* from table mscdata
Location : Person one location //* from table mscdata
Area : Person one Area //* from table mscdata
City : Person one City //* from table mscdata
State : Person one State //* from table mscdata
Country : Person one Country //* from table mscdata
Pin/Zip : Person one Pincode //* from table mscdata
Phone : Person one Telephone //* from table mscdata
Mobile : Person one Mobile //* from table mscdata
Category : Person one Category //* from table mscdata
Email : [email="personone@serviceprovider.com"]personone@serviceprovider.com[/email] //* from table msusers
Date : Wednesday, October 17th 2007, 10:07:59 //* from table msusers

Can anyone help to create PHP script (with real date conversion) for the same?
Please note : I am not a PHP programmer and new to use PHP.
Thanks in advance.


Mon Jul 13, 2009 3:05 am
Report this post
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.