| |||||||||||
MySQLand HTML Posted by goangus (goangus), 8 November 2007 Hello there, I have a small problem with a select query. I have a table with product names that contain ampersands. To comply with W3C I have entered these all into the table as '&'. This works perfectly except for one thing; if I do a Select query "WHERE prod_name like '%".$_REQUEST['q']."%' and the q variable is an "a", obviousy the query picks up on the a in "&" which in turn causes all sorts of javascript errors because of the semicolon. Is there a way of saying Select where prod_name like something but only if the something is not in an html character?? Sorry if this is unnecessarily complicated... Thanks Paul Posted by admin (Graham Ellis), 8 November 2007 Paul, I would suggest that you store the data in its real form in the MySQL database and translate it as necessary before you display it on the screen. From a computing viewpoint your data is arteficial and unclean if you store it coded in the database, and it gives rise to problems like the one you describe; go the way I've suggested and your search and javascript issues are automatically resolved.Posted by goangus (goangus), 9 November 2007 Very true, I didnt event think of translating it before display!!! So simple, sometimes you cant see the wood for the trees, as they say.Thanks Graham This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |