Re: MySQL and Numbers
This WebDNA talk-list message is from 2005
It keeps the original formatting.
numero = 62822
interpreted = N
texte = The following code displays nothing for the [myprice] variable...[sqlconnect dbtype=MySQL&host=myipaddress&database=mydatabase&uid=myuser&pwd=mypass&conn_var=conn1][/sqlconnect][sqlexecute conn_ref=conn1&result_var=rs1]SELECTthumb,title,itemid,FORMAT(price,2) AS mypriceFROM itemsWHERE viewable='Yes'ORDER BY RAND() limit 2;[/sqlexecute][sqlresult result_ref=rs1][founditems][thumb]*[title]*[itemid]*[myprice][/founditems][/sqlresult]On 8/22/05 9:08 AM, "nitai@computeroil.com"
wrote:> You are missing to ALIAS the Formated price. Try this:> > SELECT> thumb,title,itemid,FORMAT(price,2) AS myprice> FROM> Items> WHERE viewable='Yes'> ORDER BY RAND() limit 2;> > Then you can use [myprice] in your WebDNA code.> > Nitai>> -----Original Message----->> From: WebDNA Talk [mailto:WebDNA-Talk@talk.smithmicro.com] On Behalf Of>> Clint Davis>> Sent: Montag, 22. August 2005 14:15>> To: WebDNA Talk>> Subject: Re: MySQL and Numbers>> >> I have a field called price setup as a float. An item costing $20.00 would>> show in the table as simply 20. I need to format the price to 2 decimal>> places. When I run the following query, I get a weird number like>> 1078034432:>> >> SELECT thumb,title,itemid,price FROM items where viewable='Yes' ORDER BY>> RAND() limit 2;>> >> When I try to format the field in the following query, I get nothing:>> SELECT thumb,title,itemid,price,FORMAT(price,2) FROM items where>> viewable='Yes' ORDER BY RAND() limit 2;>> >> >> On 8/21/05 6:21 AM, "Thierry Almy" wrote:>> >>> It worked for me, but the filed names are different:>>>> Select ean, format(preis,2) as myprice>>> >>> I even could to it like this:>>>> Select ean, format(preis,2) as preis>>> and then referring to the original filedname [preis]>>> >>> Maybe "price" is a reserved variablename or expression?!>>> >>> Post your SQL Query in here to verify!>>> Thierry>>> >>> >>>> I also have a field named "price" in a table. The field is spec'ed as>> FLOAT,>>>> and a price of $20.00 would show in the table as just 20. When I pull>> the>>>> price from the table, it displays some weird number like 1074987008. I>> tried>>>> the format code below, but it doesn't show anything when I insert>> [myprice]>>>> into the [founditems] loop.>>>> >>>> Any ideas?>>>> >>>>> Select ean, format(price,2) as myprice>>>>>> Where xxxxx>>>>>> >>>>>> Then get it within WebDNA as [myprice].-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Associated Messages, from the most recent to the oldest:
The following code displays nothing for the [myprice] variable...[sqlconnect dbtype=MySQL&host=myipaddress&database=mydatabase&uid=myuser&pwd=mypass&conn_var=conn1][/sqlconnect][sqlexecute conn_ref=conn1&result_var=rs1]SELECTthumb,title,itemid,FORMAT(price,2) AS mypriceFROM itemsWHERE viewable='Yes'ORDER BY RAND() limit 2;[/sqlexecute][sqlresult result_ref=rs1][founditems][thumb]*[title]*[itemid]*[myprice][/founditems][/sqlresult]On 8/22/05 9:08 AM, "nitai@computeroil.com" wrote:> You are missing to ALIAS the Formated price. Try this:> > SELECT> thumb,title,itemid,FORMAT(price,2) AS myprice> FROM> Items> WHERE viewable='Yes'> ORDER BY RAND() limit 2;> > Then you can use [myprice] in your WebDNA code.> > Nitai>> -----Original Message----->> From: WebDNA Talk [mailto:WebDNA-Talk@talk.smithmicro.com] On Behalf Of>> Clint Davis>> Sent: Montag, 22. August 2005 14:15>> To: WebDNA Talk>> Subject: Re: MySQL and Numbers>> >> I have a field called price setup as a float. An item costing $20.00 would>> show in the table as simply 20. I need to format the price to 2 decimal>> places. When I run the following query, I get a weird number like>> 1078034432:>> >> SELECT thumb,title,itemid,price FROM items where viewable='Yes' ORDER BY>> RAND() limit 2;>> >> When I try to format the field in the following query, I get nothing:>> SELECT thumb,title,itemid,price,FORMAT(price,2) FROM items where>> viewable='Yes' ORDER BY RAND() limit 2;>> >> >> On 8/21/05 6:21 AM, "Thierry Almy" wrote:>> >>> It worked for me, but the filed names are different:>>>> Select ean, format(preis,2) as myprice>>> >>> I even could to it like this:>>>> Select ean, format(preis,2) as preis>>> and then referring to the original filedname [preis]>>> >>> Maybe "price" is a reserved variablename or expression?!>>> >>> Post your SQL Query in here to verify!>>> Thierry>>> >>> >>>> I also have a field named "price" in a table. The field is spec'ed as>> FLOAT,>>>> and a price of $20.00 would show in the table as just 20. When I pull>> the>>>> price from the table, it displays some weird number like 1074987008. I>> tried>>>> the format code below, but it doesn't show anything when I insert>> [myprice]>>>> into the [founditems] loop.>>>> >>>> Any ideas?>>>> >>>>> Select ean, format(price,2) as myprice>>>>>> Where xxxxx>>>>>> >>>>>> Then get it within WebDNA as [myprice].-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Clint Davis
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Showif -what am I missing??? (1999)
Search for starts with and ends with? (2003)
[math] variable question (1997)
Re:HELP - NONE STOP DIGESTS. Digest for 4/24/97) (1997)
WebCatalog NT beta 18 problem (1997)
WebMerchant Integration with Verifone's vPOS (1998)
Problem 2: Prefs file... (1997)
[Q] Novice's question (1997)
RE: creating writefile data from a nested search (1997)
Newbie problem blah blah blah (1997)
[WebDNA] How to test email validity? (2011)
Help! WebCat2 bug (1997)
OPEN MARKET PATENTS SOUND ECOMMERCE ALARM (1998)
Another pair of eyes?? (2006)
WebCat2.0 [format thousands .0f] no go (1997)
WebCatalog for guestbook ? (1997)
Setting up WebCatalog with Retail Pro data (1996)
Format of Required fields error message (1997)
Banners and sort of random display (1997)
Strange Crash (1998)