Page 1 of 1

Variable being listed twice in a script?

Posted: Tue Mar 27, 2001 3:43 pm
by Mr. Bigglesworth
I've got a vortex script using code modules. The main script reads like so:

.
.
.
lguserid: $lguserid <BR>

<getEditUsers lguserid=$lguserid lgcasedb_id=$lgcasedb_id>
.
.
.

Whereas the "getEditUsers" function is defined as follows in the code module:


.
.
.
<a name=getEditUsers PUBLIC lguserid lgcasedb_id>

lguserid2: $lguserid <BR>

<$old_db = $db>

<DB = "f:\database\admin">

<sum %s "select * from tblEditUsers where LGUSERID = '" $lguserid "' and LGCASEDB_ID = '" $lgcasedb_id "'">

<$mysql = $ret>
$mysql <BR>
.
.
.



Here's the output of the main vortex script:

lguserid: 9635
lguserid2: 9635
select * from tblEditUsers where LGUSERID = '96359635' and LGCASEDB_ID = '883'


Do you have any idea why the lguserid variable would be listed twice in the select statement? As you can tell from the code module snippet, the correct value is listed at the top of the getEditUsers function (the part with the "lguserid2:" label), but it gets doubled up in the select statement. I can't see why-- maybe I'm missing something? the $lgcasedb_id variable works fine throughout, including in the select statement.

Variable being listed twice in a script?

Posted: Tue Mar 27, 2001 3:48 pm
by John
When checking the value of variables it is always helpful to loop over the variable, e.g.

<loop $lguserid>
lguserid[$loop]: $lguserid<BR>
</loop>

as you probably have a list with two members.

You shouldn't in general construct SQL statements by inserting literals in, but rather leave the Vortex variable in the SQL for the SQL to handle.

Variable being listed twice in a script?

Posted: Thu Mar 29, 2001 8:33 pm
by Mr. Bigglesworth
That did the trick, all right. Thanks!