This topic is locked

Get id form database on event

7/2/2007 10:22:54 AM
PHPRunner General questions
D
diego author

Olá list

I need to get a id variable from database

I get this whith no problem on version 3.1 of phprunner

on version 4 is to hard to get this

look my code is works on phpruner 3.1 on phprunner 4 is not work

my "echo $idx;" return a blank on phprunner 4 on phprunner 3.1 it´s return correct

Please help me

=)

function BeforeEdit(&$values, $where)

{
$_SESSION["id"] = $values["id"];

$_SESSION["confirms"] = $values["confirms"];

$_SESSION["confirmsnomes"] = $values["confirmsnomes"];
global $conn;

$_SESSION["id"] = $values["id"];

$usuario = $_SESSION['usuario'];

$idx = "$_SESSION[id]";

echo $idx;
Sergey Kornilov admin 7/3/2007

Use $keys["id"] for this purpose.

D
diego author 7/3/2007

not work for me return this error

"Undefined variable: keys"

I need do transform the id from database on current record in a variable

function BeforeEdit(&$values, $where)

{

;

echo $keys["id"];

echo $idx;

return true;

}

J
Jane 7/3/2007

Diego,
first you need to declare $keys as global variable:

global $keys;

$idx = $keys["id"];

echo $keys["id"];


Also you should replace id with your actual field name where primary key is stored.