php mysql select numbers form a field where is also text

Hello guys,

I wonder if anybody can help me on this:

I need to select numbers from a varchar with text and numbers.
The fields have something like this: “abcd fdf-1.2” or " azfv bvv-1.2.3" they allways have the same structure only the numbers and text change.

I need to select from all rows, for example all the data where field as exactlly 1.2.3 or another number.
How can i break the string in mysql?

[php]$result = mysql_query(“SELECT * FROM fields where field = ‘1.2.1’”)[/php]

I can not change my database design, because i must use data from a third part

Thank you!

have you tried:

[php]$result = mysql_query(“SELECT * FROM fields where field like ‘%1.2.1%’”[/php]

I was trying that and it wasnt working on my local machine. I tryed again In the server and it works fine. weird!!

tks

Sponsor our Newsletter | Privacy Policy | Terms of Service