This topic is locked
[SOLVED]

 message on before record deleted event

9/6/2012 2:04:11 PM
PHPRunner General questions
D
droogers author

Hello,
I am using the following code to check for related records on the list page (Before record deleted event).

global $dal;

$tblOrder = $dal->Table("dagboekDetails");

$rs = $tblOrder->Query("dagboekID=".$deleted_values["dagboekID"],"");

$data = db_fetch_array($rs);

if($data)

return false;

else

return true;


It works great but I also want a message on the code to say that it is not possible to delete a record. How do I do ?

Sergey Kornilov admin 9/6/2012

Check PHPRunner manual related to BeforeDelete event:

http://xlinesoft.com/phprunner/docs/before_record_deleted.htm
It explains how to display message in this event.

D
droogers author 9/6/2012

I read it but don't understand it. What code do I need and where do I place it ?



Check PHPRunner manual related to BeforeDelete event:

http://xlinesoft.com/phprunner/docs/before_record_deleted.htm
It explains how to display message in this event.

Sergey Kornilov admin 9/6/2012

$message - place the message to be displayed into this variable.

D
droogers author 9/7/2012






Sorry, I also read this but don't understand it <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=67665&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />

Sergey Kornilov admin 9/7/2012
$message = "some message here";
D
droogers author 9/7/2012


$message = "some message here";



Hello,

I tried this code but it didn´t work:

global $dal;

$tblOrder = $dal->Table("dagboekDetails");

$rs = $tblOrder->Query("dagboekID=".$deleted_values["dagboekID"],"");

$data = db_fetch_array($rs);

if($data)

return false

$message="my message";

else

return true;
Sergey Kornilov admin 9/7/2012

Johan,
you are assigning value to the $message variable after 'return false;' meaning it will never be executed.

global $dal;

$tblOrder = $dal->Table("dagboekDetails");

$rs = $tblOrder->Query("dagboekID=".$deleted_values["dagboekID"],"");

$data = db_fetch_array($rs);

if($data)

{

$message="my message";

return false;

{

else

return true;
D
droogers author 9/7/2012



Johan,
you are assigning value to the $message variable after 'return false;' meaning it will never be executed.

global $dal;

$tblOrder = $dal->Table("dagboekDetails");

$rs = $tblOrder->Query("dagboekID=".$deleted_values["dagboekID"],"");

$data = db_fetch_array($rs);

if($data)

{

$message="my message";

return false;

}

else

return true;



Thanks a lot. Now it works ! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=67680&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />