strip <a href> in mysql

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

strip <a href> in mysql

Post 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?
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
Post Reply