This topic is locked

splitting $where

7/14/2008 11:12:16 AM
PHPRunner General questions
D
dakk author

I have a before record updated event. The value of $where function is:

my_table=1234
I need to capture the value 1234 only in a variable to be inserted into another table. I'm trying a php string function but haven't been successful yet. Maybe some phprunner function?

thanks

K
kdeloach 7/14/2008

I have a before record updated event. The value of $where function is:

my_table=1234
I need to capture the value 1234 only in a variable to be inserted into another table. I'm trying a php string function but haven't been successful yet. Maybe some phprunner function?

thanks


preg_match("/.[^=]+=(\d+)/", $where, $matches);
$value = $matches[1]; // yields 1234

J
Jane 7/15/2008

Hi,
use $keys["RecordID"] variable for this purpose. RecordID is your actual primary key.

D
dakk author 7/15/2008

Thanks for the replies. Both work along with the one I came up with below. Interesting I am hitting Oracle fields and $keys[my_id] works good.
$editid = preg_split('/=/', $where);

$table = $editid[0];

$dwgid = $editid[1];