[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] Accessing Database values from [perl]
Many thanks to Racke for the quick and very helpful answer.
I was *not* successful in getting the following to work:
$number = safe_tag ('data', 'inventory', 'count', $code);
However, that tip definitely pointed me in the right direction, as I found
another function- &tag_data. This is sparsely mentioned in the archives, but
it *works*! Apparently, the database name, field name, and key are arguments,
and the field value is returned. The following actually works ($code is the
record key):
$number = &tag_data('inventory', 'qty', $code);
Note that this only worked when I put [tag touch inventory][/tag] at the top
of the page.
In the end, of course, this raises the question in my mind:
What is the difference between &safe_tag and &tag_data, performance-wise?
(I'm looping through all items in a cart on the basket page.)
Anyone with some knowledge of this will find their input very much
appreciated!
-Rob Maurer
In a message dated 10/17/99 1:54:30 PM Eastern Daylight Time,
racke@linuxia.net writes:
> Handytman@aol.com writes:
>
> > ****** message to m from Handytman@aol.com ******
> >
> > I am attempting to use [perl] to check my shopping cart for items that
are
>
> > out of stock (checking the cart against the Inventory database.) The
> > $Safe{items} is well explained. What I cannot find is how to chack an
> > arbitrary database, key, field combination from Perl. I found, in the
> mailing
> > list, something called database_field($database, $key, $field), but I
> cannot
> > get this to work, and it isn't in the docs. Is it for real? Or is there
> > another way?
> >
> > Thank you very much,
> > Rob Maurer
>
> You may try the function safe_tag. Somelike that may work:
>
> $number = safe_tag ('data inventory count [item-code]');
>
> Bye
> Racke