Page 1 of 1

strip <a href> in mysql

Posted: Mon Feb 28, 2005 10:02 am
by gurjit
Hi All,

i Have a query like this to order by w_location

select * from tbl_workshop where frn_cid = $frn_cid order by w_location asc

w_location is stored in the db as "<a href="mypage?wid=1">New York</a>"

The order by w_location in the query orders the list by "wid=1" as it is stored in the field, how can i order by lets say New York and strip the html when doing my query?

Posted: Mon Feb 28, 2005 10:39 am
by CoderGoblin

Posted: Mon Feb 28, 2005 11:51 am
by gurjit
i dont understand how i can put this in the "order by w_location" part of the query?

will mysql acccept this php function as part of the query?

Posted: Mon Feb 28, 2005 11:55 am
by feyd
you can't easily strip the html during the query. It'd require a stored function/procedure or a bunch of SUBSTRING type calls.. if may be better if you stored the data in a form that was easier to work with.