Page 1 of 1

How to enter value by Row_Inserting server event?

Posted: Tue Sep 10, 2024 11:03 pm
by SOHIB

Hello All
i am trying to use this code but the value does't entered to the feild
any help

function Row_Inserting($rsold, &$rsnew) {
	// Enter your code here
	// To cancel, set return value to FALSE
		$sname=$rsnew['sinagl_name'];
		$teamnames=$rsnew['othe_team'];
	
		if($sname!=NULL)
		{
		$rsnew['visitores_name']=$sname;
		}
		else
		{
		$rsnew['visitores_names']=$teamnames;
		}

	return TRUE;
}

Re: don't enter the value

Posted: Wed Sep 11, 2024 12:22 am
by sangnandar

You might want to check the actual sql fired to db, check if it's a valid sql for the insertion of that table.
My guess is you don't have field sinagl_name and othe_team in that table.
If that's the case you need to unset them

function Row_Inserting($rsold, &$rsnew) {
  // Enter your code here
  // To cancel, set return value to FALSE
  $sname=$rsnew['sinagl_name'];
  $teamnames=$rsnew['othe_team'];
	if($sname!=NULL)
	{
          $rsnew['visitores_name']=$sname;
	}
	else
	{
	  $rsnew['visitores_names']=$teamnames;
	}
  unset($rsnew['sinagl_name']);
  unset($rsnew['othe_team']);

  return TRUE;
}