Variable being listed twice in a script?

Post Reply
Mr. Bigglesworth
Posts: 56
Joined: Fri Feb 16, 2001 6:54 pm

Variable being listed twice in a script?

Post 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.
User avatar
John
Site Admin
Posts: 2622
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Variable being listed twice in a script?

Post 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.
John Turnbull
Thunderstone Software
Mr. Bigglesworth
Posts: 56
Joined: Fri Feb 16, 2001 6:54 pm

Variable being listed twice in a script?

Post by Mr. Bigglesworth »

That did the trick, all right. Thanks!
Post Reply