justuptime.com - monitor your servers & websites

Problem with data type

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

They have: 5 posts

Joined: Sep 2006

Hi

I recive data in the following format
BMW M3 black on Business Plan 320 with 50 miles for £800.00

The data is all stored in a text field, I take the price out at the end of the field and usine the Instr and right function. which is done correctly but the i want to use the price in a calculation and it wont work, please can you tell me what is the best way to do this?

Greg K's picture
Moderator

He has: 1,601 posts

Joined: Nov 2003

I just made a test table, with one field `desc` and put your line in it. I then execute the following:

SELECT (substring(`desc`,instr(`desc`,'£')+1)*4) as VAR1 FROM `test`'

and the result back from mySQL is 3200, which is correct. Can you give an example of how you are trying to do it.

-Greg

[This space intentionally left blank]

Cool Geek Supplies: www.ThinkGeek.com

They have: 13 posts

Joined: Nov 2007

Convert the price to integer. now it will be string

[="Red"]best web hosting[/] |

security software
[URL="http://www.cheap-webhosting-

review.info/HostGator.html"][="Lime"]

Hostgator Review[/][/URL] |

[URL="http://www.cheap-webhosting-

review.info/IX.html"][="Blue"]ix web hosting

[/][/URL]