Undefined Array Key

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
amsire2
User
Posts: 130

Undefined Array Key

Post by amsire2 »

// Row Inserted event
function Row_Inserted($rsold, &$rsnew)
{
    //Log("Row Inserted");
$merit = ExecuteScalar("SELECT Peringkat_Aktiviti FROM permohonan WHERE ID_Permohonan = ".$rsnew["ID_Permohonan"]."");

if ($merit = 8){
Execute("UPDATE kehadiran SET Markah = 0.75 WHERE ID = ".$rsnew["ID"]."");
}
}

I create a code above and when I want to insert the record, error come out like this

Warning: Undefined array key "ID_Permohonan" in C:\xampp8\htdocs\eaktiviti\models\Kehadiran.php on line 1507

permohonan is my Master table and kehadiran is my details table


arbei
User
Posts: 9358

Post by arbei »

The error means there is no $rsnew["ID_Permohonan"] in $rsnew. You better check what are available first, for example, by var_dump($rsnew);die(); or Log(json_encode($rsnew)) (check the data in the log file).


mobhar
User
Posts: 11703

Post by mobhar »

Perhaps it is ID instead of ID_Permohonan field name.

In addition, double check this part:
if ($merit = 8){

That code should be:
if ($merit == 8) {


amsire2
User
Posts: 130

Post by amsire2 »

mobhar wrote:

Perhaps it is ID instead of ID_Permohonan field name.

In addition, double check this part:
if ($merit = 8){

That code should be:
if ($merit == 8) {

I'll check


Post Reply