• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

MySql SELECT statement help please

Joined
Nov 30, 2008
Messages
555 (0.10/day)
Location
Birmingham, England...
Processor Intel Core 2 Quad Q6600 @ 2.8GHz
Motherboard Gigabyte X48T-DQ6
Cooling Zalman 9500 LED CPU Cooler
Memory 2x 2GB Corsair DDR3 XMS3 DHX - 1600MH/PC3-12800
Video Card(s) Gigabyte HD4870 1GB
Storage 2x Seagate 320GB Barracuda (RAID 0) 3x 1TB Samsung F3, 140GB WD Maxtor (10,000rpm)
Display(s) 2x 20" LG Flatron L204WS
Power Supply Powercool 850W
Software Windows 7 Ultimate x64
Hi Everyone!

Please bear in mind that I'm quite new to his.

I'm trying to select everything from a table that doesn't exist.. and I'm not sure if it's possible.

I'm making a CPD tacker:
I have a CPD table to store each session.
I also have a staff table.
Then, keep record of what staff attended what course, I have a staff_cpd table which only holds staffid and cpdid IF they attended.

So my statement for everyone who attended works fine:
$sql = "SELECT staffname FROM staff JOIN staff_cpd ON staff.staffid=staff_cpd.staffid WHERE staff_cpd.cpdid=".$_GET["id"];

But I also want to show everyone who didn't attend.

Is this possible?

Thanks for taking the time to read and help.
 

Mindweaver

Moderato®™
Staff member
Joined
Apr 16, 2009
Messages
8,193 (1.50/day)
Location
Charleston, SC
System Name Tower of Power / Sechs
Processor i7 14700K / i7 5820k @ 4.5ghz
Motherboard ASUS ROG Strix Z690-A Gaming WiFi D4 / X99S GAMING 7
Cooling CM MasterLiquid ML360 Mirror ARGB Close-Loop AIO / CORSAIR Hydro Series H100i Extreme
Memory CORSAIR Vengeance LPX 32GB (2 x 16GB) DDR4 3600 / G.Skill DDR4 2800 16GB 4x4GB
Video Card(s) ASUS TUF Gaming GeForce RTX 4070 Ti / ASUS TUF Gaming GeForce RTX 3070 V2 OC Edition
Storage 4x Samsung 980 Pro 1TB M.2, 2x Crucial 1TB SSD / Samsung 870 PRO 500GB M.2
Display(s) Samsung 32" Odyssy G5 Gaming 144hz 1440p, ViewSonic 32" 72hz 1440p / 2x ViewSonic 32" 72hz 1440p
Case Phantek "400A" / Phanteks “Enthoo Pro series”
Audio Device(s) Realtek ALC4080 / Azalia Realtek ALC1150
Power Supply Corsair RM Series RM750 / Corsair CXM CX600M
Mouse Glorious Gaming Model D Wireless / Razer DeathAdder Chroma
Keyboard Glorious GMMK with box-white switches / Keychron K6 pro with blue swithes
VR HMD Quest 3 (128gb) + Rift S + HTC Vive + DK1
Software Windows 11 Pro x64 / Windows 10 Pro x64
Benchmark Scores Yes
I would do it

Statement for everybody

SELECT a.staffname, b.cpdid
FROM staff a LEFT OUTER JOIN staff_cpd b
ON a.staffid=b.staffid
ORDER BY b.cpdid;
 
Last edited:
Joined
Nov 30, 2008
Messages
555 (0.10/day)
Location
Birmingham, England...
Processor Intel Core 2 Quad Q6600 @ 2.8GHz
Motherboard Gigabyte X48T-DQ6
Cooling Zalman 9500 LED CPU Cooler
Memory 2x 2GB Corsair DDR3 XMS3 DHX - 1600MH/PC3-12800
Video Card(s) Gigabyte HD4870 1GB
Storage 2x Seagate 320GB Barracuda (RAID 0) 3x 1TB Samsung F3, 140GB WD Maxtor (10,000rpm)
Display(s) 2x 20" LG Flatron L204WS
Power Supply Powercool 850W
Software Windows 7 Ultimate x64
Hi - thanks for the reply.

Pasted as is, this returns everyone - but it lists the people that did attend at the bottom.

If I add:

WHERE b.cpdid=1

It returns the people that did attend.

Any ideas?

Thanks again!
 
Last edited:
Joined
Oct 26, 2011
Messages
430 (0.09/day)
Processor Intel i9-9900k @ 5GHz
Motherboard Gigabyte Z390 Aorus Pro Wifi
Cooling ThermalTake Riing 240
Memory 2x8GB G-Skill 3600 CL19 @ 16-19-19-20
Video Card(s) Zotac RTX 2060 Amp!
Storage 2x Samsung 860 Evo 512GB, 4x Seagate 8TB
Display(s) 2x Dell U2713H
Case CoolerMaster M500P
Power Supply ThermalTake Toughpower 730W
Software Windows 10 Pro
Try fiddling with the order by clause instead of adding another where condition:
ORDER BY b.cpdid DESC
 
Joined
Nov 30, 2008
Messages
555 (0.10/day)
Location
Birmingham, England...
Processor Intel Core 2 Quad Q6600 @ 2.8GHz
Motherboard Gigabyte X48T-DQ6
Cooling Zalman 9500 LED CPU Cooler
Memory 2x 2GB Corsair DDR3 XMS3 DHX - 1600MH/PC3-12800
Video Card(s) Gigabyte HD4870 1GB
Storage 2x Seagate 320GB Barracuda (RAID 0) 3x 1TB Samsung F3, 140GB WD Maxtor (10,000rpm)
Display(s) 2x 20" LG Flatron L204WS
Power Supply Powercool 850W
Software Windows 7 Ultimate x64
Thanks. Just swaps the order, so the people who attended appear at the top but then everyone else is listed below.

I'm hoping to exclude the people that attended from that list.
 
Joined
Sep 15, 2004
Messages
1,583 (0.22/day)
Location
Poland,Slask
System Name HAL
Processor Core i5 2500K
Motherboard Asus P8P67 Pro Rev3.1
Cooling stock
Memory 2x4GB Kingston 1600Mhz Blu
Video Card(s) Asus 560Ti DirectCuII TOP
Storage Kingston 120 3K SSD,WD Black WD1502FAEX
Display(s) LG 1440x900
Case Chieftec Mesh Midi
Audio Device(s) onboard
Power Supply Corsair TX750V2
Software w8
WHERE CPDID IS NULL
 
Joined
Nov 30, 2008
Messages
555 (0.10/day)
Location
Birmingham, England...
Processor Intel Core 2 Quad Q6600 @ 2.8GHz
Motherboard Gigabyte X48T-DQ6
Cooling Zalman 9500 LED CPU Cooler
Memory 2x 2GB Corsair DDR3 XMS3 DHX - 1600MH/PC3-12800
Video Card(s) Gigabyte HD4870 1GB
Storage 2x Seagate 320GB Barracuda (RAID 0) 3x 1TB Samsung F3, 140GB WD Maxtor (10,000rpm)
Display(s) 2x 20" LG Flatron L204WS
Power Supply Powercool 850W
Software Windows 7 Ultimate x64
Doesn't return anything..

This is what I tried:

$sql = "SELECT a.staffname, b.cpdid
FROM staff a LEFT OUTER JOIN staff_cpd b
ON a.staffid=b.staffid
WHERE b.cpdid = NULL";

Edit: Ah, I see you need to use IS NULL - let me try!
 
Last edited:
Joined
Nov 30, 2008
Messages
555 (0.10/day)
Location
Birmingham, England...
Processor Intel Core 2 Quad Q6600 @ 2.8GHz
Motherboard Gigabyte X48T-DQ6
Cooling Zalman 9500 LED CPU Cooler
Memory 2x 2GB Corsair DDR3 XMS3 DHX - 1600MH/PC3-12800
Video Card(s) Gigabyte HD4870 1GB
Storage 2x Seagate 320GB Barracuda (RAID 0) 3x 1TB Samsung F3, 140GB WD Maxtor (10,000rpm)
Display(s) 2x 20" LG Flatron L204WS
Power Supply Powercool 850W
Software Windows 7 Ultimate x64
got it - great! thanks for all the input :)

$sql = "SELECT a.staffname, b.cpdid
FROM staff a LEFT OUTER JOIN staff_cpd b
ON a.staffid=b.staffid
WHERE b.cpdid IS NULL";
 
Joined
Sep 15, 2004
Messages
1,583 (0.22/day)
Location
Poland,Slask
System Name HAL
Processor Core i5 2500K
Motherboard Asus P8P67 Pro Rev3.1
Cooling stock
Memory 2x4GB Kingston 1600Mhz Blu
Video Card(s) Asus 560Ti DirectCuII TOP
Storage Kingston 120 3K SSD,WD Black WD1502FAEX
Display(s) LG 1440x900
Case Chieftec Mesh Midi
Audio Device(s) onboard
Power Supply Corsair TX750V2
Software w8
Use just LEFT JOIN (I never use those outer/inner stuff) and make sure you tried IS NULL ?
 

Mindweaver

Moderato®™
Staff member
Joined
Apr 16, 2009
Messages
8,193 (1.50/day)
Location
Charleston, SC
System Name Tower of Power / Sechs
Processor i7 14700K / i7 5820k @ 4.5ghz
Motherboard ASUS ROG Strix Z690-A Gaming WiFi D4 / X99S GAMING 7
Cooling CM MasterLiquid ML360 Mirror ARGB Close-Loop AIO / CORSAIR Hydro Series H100i Extreme
Memory CORSAIR Vengeance LPX 32GB (2 x 16GB) DDR4 3600 / G.Skill DDR4 2800 16GB 4x4GB
Video Card(s) ASUS TUF Gaming GeForce RTX 4070 Ti / ASUS TUF Gaming GeForce RTX 3070 V2 OC Edition
Storage 4x Samsung 980 Pro 1TB M.2, 2x Crucial 1TB SSD / Samsung 870 PRO 500GB M.2
Display(s) Samsung 32" Odyssy G5 Gaming 144hz 1440p, ViewSonic 32" 72hz 1440p / 2x ViewSonic 32" 72hz 1440p
Case Phantek "400A" / Phanteks “Enthoo Pro series”
Audio Device(s) Realtek ALC4080 / Azalia Realtek ALC1150
Power Supply Corsair RM Series RM750 / Corsair CXM CX600M
Mouse Glorious Gaming Model D Wireless / Razer DeathAdder Chroma
Keyboard Glorious GMMK with box-white switches / Keychron K6 pro with blue swithes
VR HMD Quest 3 (128gb) + Rift S + HTC Vive + DK1
Software Windows 11 Pro x64 / Windows 10 Pro x64
Benchmark Scores Yes
Try what I have below. You want to use !=1 to see everything but 1

SELECT a.staffname, b.cpdid
FROM staff a LEFT OUTER JOIN staff_cpd b
ON a.staffid=b.staffid
WHERE b.cpdid!=1
ORDER BY b.cpdid;


@caleb - I used left outer because I thought he wanted everything including NULL's.
 
Last edited:
Joined
Nov 30, 2008
Messages
555 (0.10/day)
Location
Birmingham, England...
Processor Intel Core 2 Quad Q6600 @ 2.8GHz
Motherboard Gigabyte X48T-DQ6
Cooling Zalman 9500 LED CPU Cooler
Memory 2x 2GB Corsair DDR3 XMS3 DHX - 1600MH/PC3-12800
Video Card(s) Gigabyte HD4870 1GB
Storage 2x Seagate 320GB Barracuda (RAID 0) 3x 1TB Samsung F3, 140GB WD Maxtor (10,000rpm)
Display(s) 2x 20" LG Flatron L204WS
Power Supply Powercool 850W
Software Windows 7 Ultimate x64
Thanks - but like i said in previous post, all working :) using :

$sql = "SELECT a.staffname, b.cpdid
FROM staff a LEFT OUTER JOIN staff_cpd b
ON a.staffid=b.staffid
WHERE b.cpdid IS NULL";

Thanks again!
 
Joined
Sep 15, 2004
Messages
1,583 (0.22/day)
Location
Poland,Slask
System Name HAL
Processor Core i5 2500K
Motherboard Asus P8P67 Pro Rev3.1
Cooling stock
Memory 2x4GB Kingston 1600Mhz Blu
Video Card(s) Asus 560Ti DirectCuII TOP
Storage Kingston 120 3K SSD,WD Black WD1502FAEX
Display(s) LG 1440x900
Case Chieftec Mesh Midi
Audio Device(s) onboard
Power Supply Corsair TX750V2
Software w8
Yeah I know what a Left join is, all I was saying is that there is no need for the "OUTER" word as it doesnt do anything and I never used it
 

Easy Rhino

Linux Advocate
Staff member
Joined
Nov 13, 2006
Messages
15,436 (2.43/day)
Location
Mid-Atlantic
System Name Desktop
Processor i5 13600KF
Motherboard AsRock B760M Steel Legend Wifi
Cooling Noctua NH-U9S
Memory 4x 16 Gb Gskill S5 DDR5 @6000
Video Card(s) Gigabyte Gaming OC 6750 XT 12GB
Storage WD_BLACK 4TB SN850x
Display(s) Gigabye M32U
Case Corsair Carbide 400C
Audio Device(s) On Board
Power Supply EVGA Supernova 650 P2
Mouse MX Master 3s
Keyboard Logitech G915 Wireless Clicky
Software The Matrix
Yeah I know what a Left join is, all I was saying is that there is no need for the "OUTER" word as it doesnt do anything and I never used it

What do you mean OUTER does not do anything?
 
Joined
Sep 15, 2004
Messages
1,583 (0.22/day)
Location
Poland,Slask
System Name HAL
Processor Core i5 2500K
Motherboard Asus P8P67 Pro Rev3.1
Cooling stock
Memory 2x4GB Kingston 1600Mhz Blu
Video Card(s) Asus 560Ti DirectCuII TOP
Storage Kingston 120 3K SSD,WD Black WD1502FAEX
Display(s) LG 1440x900
Case Chieftec Mesh Midi
Audio Device(s) onboard
Power Supply Corsair TX750V2
Software w8
LEFT JOIN does exactly the same thing as LEFT OUTER JOIN
 

Easy Rhino

Linux Advocate
Staff member
Joined
Nov 13, 2006
Messages
15,436 (2.43/day)
Location
Mid-Atlantic
System Name Desktop
Processor i5 13600KF
Motherboard AsRock B760M Steel Legend Wifi
Cooling Noctua NH-U9S
Memory 4x 16 Gb Gskill S5 DDR5 @6000
Video Card(s) Gigabyte Gaming OC 6750 XT 12GB
Storage WD_BLACK 4TB SN850x
Display(s) Gigabye M32U
Case Corsair Carbide 400C
Audio Device(s) On Board
Power Supply EVGA Supernova 650 P2
Mouse MX Master 3s
Keyboard Logitech G915 Wireless Clicky
Software The Matrix
LEFT JOIN does exactly the same thing as LEFT OUTER JOIN

I know that. You said the word OUTER doesn't do anything when in fact it clarifies that is not a LEFT INNER JOIN. it is good practice to specifcy OUTER or INNER for the sake of readability especially when you are working with a dozen tables and doing mulitple joins on each.
 
Joined
Nov 30, 2008
Messages
555 (0.10/day)
Location
Birmingham, England...
Processor Intel Core 2 Quad Q6600 @ 2.8GHz
Motherboard Gigabyte X48T-DQ6
Cooling Zalman 9500 LED CPU Cooler
Memory 2x 2GB Corsair DDR3 XMS3 DHX - 1600MH/PC3-12800
Video Card(s) Gigabyte HD4870 1GB
Storage 2x Seagate 320GB Barracuda (RAID 0) 3x 1TB Samsung F3, 140GB WD Maxtor (10,000rpm)
Display(s) 2x 20" LG Flatron L204WS
Power Supply Powercool 850W
Software Windows 7 Ultimate x64
Hi - run in to a problem with this SELECT statement so opening this back up :)

It works, but when a second CPD session is added, it only shows people that didn't attend the other session. It should show everyone, because no one has attended. Any ideas?

Thanks for taking the time to read and help!
 

Easy Rhino

Linux Advocate
Staff member
Joined
Nov 13, 2006
Messages
15,436 (2.43/day)
Location
Mid-Atlantic
System Name Desktop
Processor i5 13600KF
Motherboard AsRock B760M Steel Legend Wifi
Cooling Noctua NH-U9S
Memory 4x 16 Gb Gskill S5 DDR5 @6000
Video Card(s) Gigabyte Gaming OC 6750 XT 12GB
Storage WD_BLACK 4TB SN850x
Display(s) Gigabye M32U
Case Corsair Carbide 400C
Audio Device(s) On Board
Power Supply EVGA Supernova 650 P2
Mouse MX Master 3s
Keyboard Logitech G915 Wireless Clicky
Software The Matrix
It is hard to know without the data infront of me.
 
Joined
Jun 28, 2012
Messages
246 (0.06/day)
System Name Main Pc | Xeon rig
Processor Intel Core i5-4670 @3.6Ghz | Intel Xeon X5675 @stock
Motherboard Gigabyte GA-Z87-HD3 | Sabertooth X58
Cooling Noctua NH-U9B SE2 | Noctua NH-D14
Memory 16GB Crucial OC @ 2133mhz | 12 GB Various
Video Card(s) MSI RX480 | MSI R7970 TF III 3GD5 OC BE (Bios mod 1081 mV)
Storage 120GB Samsung Evo\ 4TB WD HDD | 120GB Samsung Evo
Case NZXT H440 | Fractal Design Define R5
Power Supply Seasonic 650 Watt| Nexus 450
Software Windows 10 Pro x64 | Windows Server 2016 Datacenter x64
You could try something like this: Im pretty sure this is not the solution, but i think I you can do something with it. especially look at the while statement is false

<?php

//Selecting data with an prepared statement

$link = mysqli_connect("localhost", "root", "yourpassword here", "database here", mysql port here 3307);
// Your query
$stmt = mysqli_prepare($link, ""SELECT a.staffname, b.cpdid FROM staff a LEFT OUTER JOIN staff_cpd b ON a.staffid=b.staffid WHERE b.cpdid IS ?";");
mysqli_stmt_bind_param($stmt, "s", $id);
$id = ($_GET['id']);
mysqli_stmt_bind_param($stmt, $staffname, $cpdid)
// run the statement
mysqli_stmt_execute($stmt);

// Check for id who are not database
while (mysqli_stmt_fetch($stmt) == FALSE) {
print ($staffname . "With id" . $cpdid . "Has not attended<br>");
}

?>
 
Joined
Feb 8, 2012
Messages
3,012 (0.68/day)
Location
Zagreb, Croatia
System Name Windows 10 64-bit Core i7 6700
Processor Intel Core i7 6700
Motherboard Asus Z170M-PLUS
Cooling Corsair AIO
Memory 2 x 8 GB Kingston DDR4 2666
Video Card(s) Gigabyte NVIDIA GeForce GTX 1060 6GB
Storage Western Digital Caviar Blue 1 TB, Seagate Baracuda 1 TB
Display(s) Dell P2414H
Case Corsair Carbide Air 540
Audio Device(s) Realtek HD Audio
Power Supply Corsair TX v2 650W
Mouse Steelseries Sensei
Keyboard CM Storm Quickfire Pro, Cherry MX Reds
Software MS Windows 10 Pro 64-bit
You need to use left join and check for nulls

$sql_who_did_not_attend = "SELECT staffname FROM staff LEFT JOIN staff_cpd ON staff.staffid=staff_cpd.staffid WHERE staff_cpd.staffid IS NULL AND staff_cpd.cpdid=".$_GET["id"];
 
Joined
Nov 30, 2008
Messages
555 (0.10/day)
Location
Birmingham, England...
Processor Intel Core 2 Quad Q6600 @ 2.8GHz
Motherboard Gigabyte X48T-DQ6
Cooling Zalman 9500 LED CPU Cooler
Memory 2x 2GB Corsair DDR3 XMS3 DHX - 1600MH/PC3-12800
Video Card(s) Gigabyte HD4870 1GB
Storage 2x Seagate 320GB Barracuda (RAID 0) 3x 1TB Samsung F3, 140GB WD Maxtor (10,000rpm)
Display(s) 2x 20" LG Flatron L204WS
Power Supply Powercool 850W
Software Windows 7 Ultimate x64
Thanks for your input!

Rave: It just times out, i'm not good enough to manipulate the code to try anything different.

Biggie: It returns no data.

If someone is willing to jump on my phpmyadmin to take a look, please PM me for the details.
 
Joined
Oct 24, 2009
Messages
430 (0.08/day)
Location
Belgium
System Name Illidan
Processor AMD Ryzen 9 5900X
Motherboard Gigabyte B550 Aorus Pro V2
Cooling Scythe Mugen 4
Memory G.Skill Trident Z 32GB DDR4 3000MHz 14CL
Video Card(s) AMD Radeon RX 6900 XT
Storage Crucial P1 1TB + Sandisk Ultra II 960GB + Samsung EVO Plus 970 2TB + F3 1TB + Toshiba X300 4TB
Display(s) Iiyama G-MASTER G4380UHSU-B1
Case Corsair 750D Airflow
Audio Device(s) Sony WH1000-XM4
Power Supply Seasonic Focus PX-850
Mouse Logitech G604
Keyboard Corsair Vengeance K70 (Cherry MX Red)
Software Windows 11 Pro
How about something like this:

$sql = "select st.staffname
from staff st
where st.staffid not in (
select st2.staffid
from staff_cpd st2
where st2.cpdid=".$_GET["id"].")"
 
Joined
Nov 30, 2008
Messages
555 (0.10/day)
Location
Birmingham, England...
Processor Intel Core 2 Quad Q6600 @ 2.8GHz
Motherboard Gigabyte X48T-DQ6
Cooling Zalman 9500 LED CPU Cooler
Memory 2x 2GB Corsair DDR3 XMS3 DHX - 1600MH/PC3-12800
Video Card(s) Gigabyte HD4870 1GB
Storage 2x Seagate 320GB Barracuda (RAID 0) 3x 1TB Samsung F3, 140GB WD Maxtor (10,000rpm)
Display(s) 2x 20" LG Flatron L204WS
Power Supply Powercool 850W
Software Windows 7 Ultimate x64
Thanks CounterZues - this looks promising.. need to test further :)
 
Joined
Nov 30, 2008
Messages
555 (0.10/day)
Location
Birmingham, England...
Processor Intel Core 2 Quad Q6600 @ 2.8GHz
Motherboard Gigabyte X48T-DQ6
Cooling Zalman 9500 LED CPU Cooler
Memory 2x 2GB Corsair DDR3 XMS3 DHX - 1600MH/PC3-12800
Video Card(s) Gigabyte HD4870 1GB
Storage 2x Seagate 320GB Barracuda (RAID 0) 3x 1TB Samsung F3, 140GB WD Maxtor (10,000rpm)
Display(s) 2x 20" LG Flatron L204WS
Power Supply Powercool 850W
Software Windows 7 Ultimate x64
awesome :) working perfectly.. thank you!

How about something like this:

$sql = "select st.staffname
from staff st
where st.staffid not in (
select st2.staffid
from staff_cpd st2
where st2.cpdid=".$_GET["id"].")"
 
Joined
Feb 8, 2012
Messages
3,012 (0.68/day)
Location
Zagreb, Croatia
System Name Windows 10 64-bit Core i7 6700
Processor Intel Core i7 6700
Motherboard Asus Z170M-PLUS
Cooling Corsair AIO
Memory 2 x 8 GB Kingston DDR4 2666
Video Card(s) Gigabyte NVIDIA GeForce GTX 1060 6GB
Storage Western Digital Caviar Blue 1 TB, Seagate Baracuda 1 TB
Display(s) Dell P2414H
Case Corsair Carbide Air 540
Audio Device(s) Realtek HD Audio
Power Supply Corsair TX v2 650W
Mouse Steelseries Sensei
Keyboard CM Storm Quickfire Pro, Cherry MX Reds
Software MS Windows 10 Pro 64-bit
You need to use left join and check for nulls

$sql_who_did_not_attend = "SELECT staffname FROM staff LEFT JOIN staff_cpd ON staff.staffid=staff_cpd.staffid WHERE staff_cpd.staffid IS NULL AND staff_cpd.cpdid=".$_GET["id"];

Biggie: It returns no data.

That's because I fucked up

Code:
$sql_who_did_not_attend = "SELECT staffname FROM staff 
LEFT OUTER JOIN staff_cpd ON staff.staffid=staff_cpd.staffid 
WHERE staff_cpd.staffid IS NULL AND staff_cpd.cpdid=".$_GET["id"];

"not in" subquery option by @CounterZeus is also fine, but the faster way is with "not exists"

Code:
$sql_who_did_not_attend = "select staff.staffname
from staff
where not exists
(select 1
from staff_cpd
where staff_cpd.staffid=staff.stafid
and staff_cpd.cpdid=".$_GET["id"].")";

I'm doing all this from my head so I might have fucked up again
 
Joined
Nov 30, 2008
Messages
555 (0.10/day)
Location
Birmingham, England...
Processor Intel Core 2 Quad Q6600 @ 2.8GHz
Motherboard Gigabyte X48T-DQ6
Cooling Zalman 9500 LED CPU Cooler
Memory 2x 2GB Corsair DDR3 XMS3 DHX - 1600MH/PC3-12800
Video Card(s) Gigabyte HD4870 1GB
Storage 2x Seagate 320GB Barracuda (RAID 0) 3x 1TB Samsung F3, 140GB WD Maxtor (10,000rpm)
Display(s) 2x 20" LG Flatron L204WS
Power Supply Powercool 850W
Software Windows 7 Ultimate x64
lol thanks Biggie!

i've added startdate and enddate columns in the staff table so I may come back for more help if I can't figure it out :)
 
Top