This topic is locked

global $dal

7/26/2015 1:04:33 PM
PHPRunner General questions
J
jdu001 author

Hello,
I want to use the DAL. I have copied and adapted examples from the manual.
This is my code:
function BeforeEdit(&$values, $where, &$oldvalues, &$keys, &$message, $inline, &$pageObject)

{
global $dal;
$tabel = $dal->Table("harm_tarieven");

$tabel->Param["Lid_ID"]=$values["ID"];

$tabel->Value["BedragRepetitie"]=$values["BedragRepetitie"];

$tabel->Value["BedragConcert"]=$values["BedragConcert"];

$tabel->Value["BedragGroep"]=$values["BedragGroep"];

$tabel->Update();
unset($values["BedragRepetitie"]);

unset($values["BedragConcert"]);

unset($values["BedragGroep"]);
return true;

;

} // function BeforeEdit
When I debug my code I see the $dal object after the statemant global $dal;

$dal tDAL

lstTables null

Table Array [0]

tbl31547test_at_localhostharm_composities null

tbl31547test_at_localhost__harm_docenten null

tbl31547test_at_localhost
harm_uithulpen null

tbl31547test_at_localhost__harm_tarieven null
After the $tabel->Update(); statement I get following errors:

( ! ) Parse error: syntax error, unexpected 'test_at_localhost' (T_STRING) in E:\wamp\www\Harmonie80\include\dal.php(179) : eval()'d code on line 5

( ! ) Fatal error: Class 'class_31547test_at_localhost__harm_tarieven' not found in E:\wamp\www\Harmonie80\include\dal.php on line 180
Is the $dal object filled as it should be? If not, where do I fill it correctly.
Greetings,
Jo van Duin

lefty 7/26/2015



Hello,
I want to use the DAL. I have copied and adapted examples from the manual.
This is my code:
function BeforeEdit(&$values, $where, &$oldvalues, &$keys, &$message, $inline, &$pageObject)

{
global $dal;
$tabel = $dal->Table("harm_tarieven");

$tabel->Param["Lid_ID"]=$values["ID"];

$tabel->Value["BedragRepetitie"]=$values["BedragRepetitie"];

$tabel->Value["BedragConcert"]=$values["BedragConcert"];

$tabel->Value["BedragGroep"]=$values["BedragGroep"];

$tabel->Update();
unset($values["BedragRepetitie"]);

unset($values["BedragConcert"]);

unset($values["BedragGroep"]);
return true;

;

} // function BeforeEdit
When I debug my code I see the $dal object after the statemant global $dal;

$dal tDAL

lstTables null

Table Array [0]

tbl31547test_at_localhostharm_composities null

tbl31547test_at_localhost__harm_docenten null

tbl31547test_at_localhost
harm_uithulpen null

tbl31547test_at_localhost__harm_tarieven null
After the $tabel->Update(); statement I get following errors:

( ! ) Parse error: syntax error, unexpected 'test_at_localhost' (T_STRING) in E:\wamp\www\Harmonie80\include\dal.php(179) : eval()'d code on line 5

( ! ) Fatal error: Class 'class_31547test_at_localhost__harm_tarieven' not found in E:\wamp\www\Harmonie80\include\dal.php on line 180
Is the $dal object filled as it should be? If not, where do I fill it correctly.
Greetings,
Jo van Duin


Doesn't look like you defined the tables using dal try this. IF you are using different lanquage for table then okay if not tabel should be table
global $dal;
$tableharm_tarieven = $dal->Table("harm_tarieven");

$tableharm_tarieven->Param["Lid_ID"]=$values["ID"];

$tableharm_tarieven->Value["BedragRepetitie"]=$values["BedragRepetitie"];

$tableharm_tarieven->Value["BedragConcert"]=$values["BedragConcert"];

$tableharm_tarieven->Value["BedragGroep"]=$values["BedragGroep"];

$tableharm_tarieven->Update();

J
jdu001 author 8/4/2015



Doesn't look like you defined the tables using dal try this. IF you are using different lanquage for table then okay if not tabel should be table
global $dal;
$tableharm_tarieven = $dal->Table("harm_tarieven");

$tableharm_tarieven->Param["Lid_ID"]=$values["ID"];

$tableharm_tarieven->Value["BedragRepetitie"]=$values["BedragRepetitie"];

$tableharm_tarieven->Value["BedragConcert"]=$values["BedragConcert"];

$tableharm_tarieven->Value["BedragGroep"]=$values["BedragGroep"];

$tableharm_tarieven->Update();


I have tried several options. I get always the same message.

I have made a new project and used the Cars-template. Then I don't get the message and the eval() statement works.
When I use a Cars-table in my own project it doesn't work and I get the same message.
Greetings,
Jo