CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   MySQL (http://www.codingforums.com/forumdisplay.php?f=7)
-   -   Problem with seemingly simple query - Help please (http://www.codingforums.com/showthread.php?t=283877)

frank5050 12-10-2012 03:40 AM

Problem with seemingly simple query - Help please
 
I have a database table with a column 'phonecarriers' that has some network names stored in it such as,

phonecarriers
AT&T
Tmobile
Verizon

Some values in the column 'phonecarriers' have ampersand (&) such as AT&T while others don't (TMobile or Verizon)


When I query the database with the follwing query:

$sql="SELECT * FROM table WHERE phone= '$model' and phonecarriers = '$network' ";



I get correct results if $network variable is either TMobile or Verizon.

I do not get results if $network variable is AT&T.

I also get correct results if instead of '$network' , I plug and type network = 'AT&T' directly in the query.


What can I do differently, or how can I write the query so that that when the '$network' variable is AT&T that the query would fetch results from the table where phonecarriers is AT&T.


Any help would be appreciated,
Thanks

sunfighter 12-10-2012 04:29 AM

How are you defining $network? I don't think the problem is in using an ampersand, because you obtain results with network = 'AT&T'.


All times are GMT +1. The time now is 08:13 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.