$query2 = "SELECT * FROM inventory WHERE sale < 3 AND ID='3'"; Why not just select them one at a time?