type conversion required?
I would like to save the html product of a database query for subsequent recall. If I have something like this: <!--#in sqlMethod--> <!--#call "REQUEST.set('htmlString',htmlString+PRICE+'</td><td>'+DESCR IPTION+'</td><td>)"--> <!--#/in--> where PRICE is a numeric field from the database, then I get a typeError - presumably because PRICE is numeric and the others are text. How do I convert PRICE into a string to avoid this problem? ------- Regards, Graham Chiu gchiu<at>compkarori.co.nz
At 12:52 01/07/99 , Graham Chiu wrote:
I would like to save the html product of a database query for subsequent recall.
If I have something like this:
<!--#in sqlMethod--> <!--#call "REQUEST.set('htmlString',htmlString+PRICE+'</td><td>'+DESCR IPTION+'</td><td>)"--> <!--#/in-->
where PRICE is a numeric field from the database, then I get a typeError - presumably because PRICE is numeric and the others are text.
How do I convert PRICE into a string to avoid this problem?
By using the str method of the _ object: <!--#call "REQUEST.set('htmlString', htmlString + _.str(PRICE) + '</td><td>' + DESCRIPTION + '</td><td>)"--> -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
In article <4.2.0.58.19990701134822.00cdf690@lisp.atmm.nl>, Martijn Pieters <mj@antraciet.nl> writes
By using the str method of the _ object:
<!--#call "REQUEST.set('htmlString', htmlString + _.str(PRICE) + '</td><td>' + DESCRIPTION + '</td><td>)"-->
Thanks, that worked fine. Is it also possible to do something like this? _.str(PRICE fmt=dollars-and-cents) ------- Regards, Graham Chiu gchiu<at>compkarori.co.nz
participants (2)
-
Graham Chiu -
Martijn Pieters