S
|
swanside 6/11/2009 |
If Plot is the main table, I would have PlotId as my Key. |
A
|
Azeem author 6/11/2009 |
If Plot is the main table, I would have PlotId as my Key. I would then have PlotId on the other tables to link everything by. I would still have ClientId as a key on the Clients Table, and PaymentId as a key on the payments table. Then from Plot Add_new you would put in the details, I would have a field called clients and select the client from the clients table. This would generate an Id value of say 100001. As the Clients and Payments are linked by PlotId, From teh Plots table add_new, when you click on add new in the clients field, it would generate a cleintId in the clients table. The payments table would contain links to plots and clients.
|
A
|
Azeem author 6/11/2009 |
------------------------------- Hello swanside, Thank a lot for your reply...But i think clients table is the master table though logically you are right its plots table that should be the main table...I am writing here the database schema for you.Please tell me if u have some suggestions. Main scenario is such that a client can have more than one plots and we have to maintain the details of the payments as well... -- phpMyAdmin SQL Dump -- version 3.0.1.1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jun 11, 2009 at 06:17 PM -- Server version: 5.1.30 -- PHP Version: 5.2.7 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT /; /!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS /; /!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION /; /!40101 SET NAMES utf8 /; -- -- Database: `phprunner` -- -- -------------------------------------------------------- -- -- Table structure for table `clients` -- CREATE TABLE `clients` ( `client_id` int(11) NOT NULL AUTO_INCREMENT, `plot_ID` int(11) NOT NULL, `status` int(10) NOT NULL, `path` varchar(100) NOT NULL, `path2` varchar(100) NOT NULL, `date_issue` date DEFAULT NULL, `date_enter` date DEFAULT NULL, `username` varchar(20) DEFAULT NULL, `fhname` varchar(30) NOT NULL, `gender` varchar(10) NOT NULL, `nic_no` varchar(30) NOT NULL, `nicop_no` varchar(30) NOT NULL, `passport_no` varchar(40) NOT NULL, `place_issue` varchar(40) NOT NULL, `present_address` varchar(40) NOT NULL, `pak_address` varchar(40) NOT NULL, `phone_off` varchar(25) NOT NULL, `fax` varchar(25) NOT NULL, `email` varchar(30) NOT NULL, `phone_res` varchar(25) NOT NULL, `cpp_name` varchar(30) NOT NULL, `cpp_phone` varchar(30) NOT NULL, `cpp_address` varchar(40) NOT NULL, `nic_copy` varchar(10) NOT NULL, `nicop_copy` varchar(10) NOT NULL, `pass_copy` varchar(10) NOT NULL, PRIMARY KEY (`client_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=29 ; -- -------------------------------------------------------- -- -- Table structure for table `payments` -- CREATE TABLE `payments` ( `Payment_ID` int(11) NOT NULL AUTO_INCREMENT, `client_id` varchar(10) NOT NULL, `PMethod` varchar(50) DEFAULT NULL, `No_Istallments` varchar(50) DEFAULT NULL, `Amount_Paid` varchar(50) DEFAULT NULL, `Amount_Due` varchar(50) DEFAULT NULL, `Payment_Terms` mediumtext, `Cheque_No` varchar(50) DEFAULT NULL, `Notes` mediumtext, `Date` date DEFAULT NULL, `Bank_No` varchar(20) DEFAULT NULL, PRIMARY KEY (`Payment_ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=19 ; -- -------------------------------------------------------- -- -- Table structure for table `plots` -- CREATE TABLE `plots` ( `plot_ID` int(11) NOT NULL AUTO_INCREMENT, `plot_no` varchar(45) NOT NULL, `plot_cat` varchar(10) NOT NULL, PRIMARY KEY (`plot_ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=198 ; Thanks for your assistance...
|
A
|
Azeem author 6/13/2009 |
The scenario was like I had a customer apllication form for plots. Mostly getting the customer data and it has a droopdown field showing the available plots from the plots table where plots.clients_id='NULL' and status='Null'. |
J
|
Jane 6/16/2009 |
Hi, |