I wrote this code but the lines do not appear related

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

I wrote this code but the lines do not appear related

Post by saleh »

I have a table estmarh
I need:
Identity_moder=Identity
Identity in ( SELECT * FROM users WHERE = Identity )
I need all the lines in which moder=Identity And it is associated with Identity Show Level 2

I wrote this code but the lines do not appear related
Is it possible to correct code

// UserID Loaded event
function UserID_Loaded() {
//echo "UserID Loaded: " . $this->UserIDList() . "<br>";
global $Page;
if ($Page && $Page->TableName == "estmarh" && CurrentUserLevel() == "2" && ew_AddFilter($filter, " Identity_moder == SELECT * FROM users WHERE = Identity ") ) {
$this->AddUserID(-1);

}}

thank you


mobhar
User
Posts: 11660

Post by mobhar »

Wrong code. You cannot use "ew_AddFilter" function in "UserID_Loaded" server event.


saleh
User
Posts: 470

Post by saleh »

He worked View :
Information appears correctly, but when added show a problem

Failed to execute SQL. Error: The target table estmarh_moder of the INSERT is not insertable-into

SELECT DISTINCT estmarh.*
FROM estmarh
JOIN users ON estmarh.SchID = users.SchID
WHERE (estmarh.SchID = users.SchID)


mobhar
User
Posts: 11660

Post by mobhar »

Search for keyword "UpdateTable" in this forum for your references about how to insert data into Database View that joins more than one table.


saleh
User
Posts: 470

Post by saleh »

The problem ended Status :UpdateTable
1-
// Row Updating event
function Row_Updating($rsold, &$rsnew) {
// Enter your code here
// To cancel, set return value to FALSE
$this->UpdateTable = "estmarh";

return TRUE;

}

2-
// Row Inserting event
function Row_Inserting($rsold, &$rsnew) {
// Enter your code here
// To cancel, set return value to FALSE
$this->UpdateTable = "estmarh";
return TRUE;
}

Thank you so much


Post Reply