[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] [perl] question
>****** message to minivend-users from Mike Gross
><mike@jensalt.com> ******
>
>At 08:45 AM 11/22/99 -0500, you wrote:
> >****** message to minivend-users from "Mr. Christopher F. Miller"
><cfm@maine.com> ******
> >
> >On Mon, Nov 22, 1999 at 01:01:27AM -0700, Mike Gross wrote:
> >>
> >> foreach $itemcode (@related_products) {
> >> my $productdescriptionhash=<<'EOF';
> >> [sql type=hash][arg]$itemcode[/arg]select description from products
> >> where product_id = %s[/sql]
> >> EOF
> >
> >Did you try:
> > [sql type=hash]select description from products where product_id
>='[item-code]'[/sql]
>
>The problem is that [item-code] is the identifier for the product being
>displayed on the flypage. $itemcode is the identifier for a item listed in
>the related_products field of the products database for the current
>[itemcode]. I suppose I could have used a more descriptive name than
>$itemcode, such as $relateditemcode. I am trying to pull the description
>field from the database for each $itemcode, not [item-code]
>
>
> >The [item-code] is usually early enough in order of precedence.
>
>Using it would make the code work, just not with the correct results.
>Thanks anyway.
As far as I've been able to figure out from perusing the archives,
you can't do what you're trying to do, and this is why: The SQL tags
get evaluated BEFORE the perl code runs.
As for myself, I can't even make this work:
<form>
<input type="hidden" name="inSpam" value="3">
</form>
[value name=inSpam escaped=1 set="4"]
<table>
[sql html]
[arg][value inSpam][/arg]
select SKU, Short_Description, Price from oztest.items where ID_C = %s
[/sql]
</table>
I've also tried putting scratch variables into the [arg] slot. In
every case, the query returns as if %s contained the value 0.
However, if I just use an integer:
<table>
[sql html]
[arg]4[/arg]
select SKU, Short_Description, Price from oztest.items where ID_C = %s
[/sql]
</table>
I get the right result.
Since I'm basically copping the example straight out of the
documentation, I'm baffled.
>-
>To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
>email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
>Archive of past messages: http://www.minivend.com/minivend/minivend-list