Select special characters

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
mazola
Forum Newbie
Posts: 2
Joined: Thu Jul 17, 2008 1:49 pm

Select special characters

Post by mazola »

Hi All

I am selecting data from mysql database; below is the scenario;

I have a column with data like 'Products & Services'. I get a value on my page, i.e page title, which is 'Products & Services'.
I then pass this value to my query as 'select * from tbl where fieldname='Products & Services''. Since the actual data stored in the table is 'Products & Services', I do not get any results.

Please any help on this will be appreciated. I am using php to execute the query.
Thanks in advance.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Select special characters

Post by AbraCadaver »

Code: Select all

htmlentities("Products & Services");
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply