This topic is locked

remove record after job is complete

5/10/2019 9:00:16 AM
PHPRunner General questions
S
stanbar1 author

Hello. I have table AdminJobs and 5 CustomView Tables:

id,

CompanyName,

ChauffeurName,

ChauffeurShortName,

ChauffeurE-Mail,

Job,

Date,

JobDay,

Misc,

PassengerName,

Extras,

MittingArea,

AddStop1,

AddStop2,

AddStop3,

AddStop4,

Cars,

PassengerQuantity,

Fare,

NoShow,

Confirmation,

AirportName,

AirportCode,

AirlineName,

AirlineCode,

AirlineCountry,

AirlineDoorNumber,

FlightNumber,

ArlineInfo,

AirlinePickUp,

AirportName1,

AirportCode1,

AirlineName1,

AirlineCode1,

AirlineCountry1,

FlightNumber1,

AirlineDoorNumber1,

ArlineInfoDo,

AirlineDropOff,

PortName,

PortCode,

CruiseLine,

CruiseLineCode,

ShipName,

Terminal,

PortPickUp,

PortName1,

PortCode1,

CruiseLine1,

CruiseLineCode1,

ShipName1,

Terminal1,

PortDropOff,

HotelName,

BuildingNumber,

StreetName,

City,

State,

ZipCode,

HotelPickup,

HotelName1,

BuildingNumber1,

StreetName1,

City1,

State1,

ZipCode1,

HotelDropOff,

RideDetails,

SpecialReguirments,

Quantity,

Name,

CurrentStatus,

Time,

CurrentStatus1,

Time1,

CurrentStatus2,

Time2,

CurrentStatus3,

Time3,

Hourly,

FareByHour,

WatingTime,

Picture,

Express Line,

Tolls,

Parking,

Comments,

Completed,

DateCompleted,

ForDate,

ForPassenger,

ForPickUp,

ForDropOff,

ForCar,

ForFlight,

ForStatus,

ForPassengers,

ForCurrency,

ForMisc,

ForExtras,

ForConfirmation,

ForRideDetails,

ForMitting

FROM AdminJobs

I need when my drivers completed job, remove from AdminJobs and move to table:JobsHistory..can you Please Help me. I try use code event after update:

$sql = "delete from AdminJobs where id_Job= ".$values['id_Job'];

CustomQuery($sql);
$sql = "INSERT INTO JobsHistory (id_Job, id_PassengerName,Date) values ($id_Job, ".$values['id_PassengerName'].",'".$Date."')";

CustomQuery($sql);

it's don't work.

A
acpan 5/10/2019

You are on wrong forum.
Anyway, see my commens below.
Print out the value of $values['id_Job'] first and see if the values is empty:
echo $values['id_Job'];
$values['id_Job'] has not changed (not written to DB), i suspect it is empty or NULL, only when the value is changed, than it will fill up $values['id_Job'].

so your delete will fail. You can try $oldvalues['id_Job'] or $keys['id_Job'], again print out to see.
The description:
$values - array of values has been written to the database.

To access specific field value use $values["FieldName"]
$oldvalues - array with replaced field values. To access specific column value use

$oldvalues["FieldName"]
$keys - array of key column values that point to the edited record. To access

specific key column use $keys["KeyFieldName"]
ACP