David Hopkins
|
| Posted: 11/20/2002, 1:31 PM |
|
Hello all,
I am trying to run a sql query from an after insert event.
What i waht to do:
$exesql = 'delete * from temp1 where delete1="yes"';
$this->query($exesql);
I get an error undefind functiona call. How do I fix this so that I can
run this from the code. I am running php 4.2.3
JD
|
|
|
 |
Don Anderson
|
| Posted: 11/21/2002, 3:18 AM |
|
Hi,
This is a common frustration. The tutorial and manual are not very clear on
this point.
You have to declare globals, otherwise it will never work. 
Here is an example.
global $"<insert_your_control_name>"; // Don't include the quotes marks.
global $DB"<insert_your_connection_name>";
// Then you need to assign the db handle.
// You can use an existing one e.g.
$db = $"<insert_your_control_name>"->ds;
// OR sometimes I prefer to create a new db handle.
$db = new clsDB"<insert_your_connection_name>";
// So then your code becomes.
$exesql = 'delete * from temp1 where delete1="yes"';
$db->query($exesql);
Good Luck,
Don Anderson
"David Hopkins" <fenris@one.net> wrote in message
news:3DDBFF14.BBEBA623@one.net...
> Hello all,
>
> I am trying to run a sql query from an after insert event.
>
> What i waht to do:
>
> $exesql = 'delete * from temp1 where delete1="yes"';
> $this->query($exesql);
>
> I get an error undefind functiona call. How do I fix this so that I can
> run this from the code. I am running php 4.2.3
>
> JD
>
|
|
|
 |
|