When you add a job it will always have items in that table.
Here are the two tables:
[code]CREATE TABLE jobs (
id int(5) NOT NULL AUTO_INCREMENT,
customer_id int(11) NOT NULL,
job_id int(30) NOT NULL,
contact_name varchar(40) NOT NULL,
address1 varchar(50) NOT NULL,
address2 varchar(50) NOT NULL,
address3 varchar(50) NOT NULL,
postcd varchar(8) NOT NULL,
cid varchar(50) NOT NULL,
deliver varchar(50) NOT NULL,
fromdate int(10) NOT NULL,
todate int(10) NOT NULL,
before_vat decimal(10,2) NOT NULL,
vat decimal(10,2) NOT NULL,
full_total decimal(10,2) NOT NULL,
delprice decimal(10,2) NOT NULL,
notes varchar(1000) NOT NULL,
quote varchar(10) NOT NULL,
KEY jobid (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE job_items (
id int(10) NOT NULL AUTO_INCREMENT,
job_id int(10) NOT NULL DEFAULT ‘0’,
quantity int(25) NOT NULL DEFAULT ‘0’,
product_id int(10) DEFAULT ‘0’,
unit_price decimal(25,2) DEFAULT ‘0.00’,
description text COLLATE utf8_unicode_ci,
total decimal(25,2) DEFAULT ‘0.00’,
before_vat decimal(10,2) NOT NULL,
vat decimal(10,2) NOT NULL,
subtotal decimal(10,2) NOT NULL,
discount varchar(20) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
[/code]