bccamp
Technical User
- Jan 20, 2005
- 69
My code passes a variable through the url and is decoded on the page. The problem is 2 of the variables have " ' ". EX. Women's. When I go to search the db, I get mysql_num_rows() not valid: supplied argument is not a valid MySQL result...
Is there a way, without changing the data in the database, to make MySQL see Women's as Women%27s while allowing all other strings without this problem to work?
Or is there a better way entirely that I'm not seeing to get:
$query="SELECT * FROM db WHERE CATEGORY = '$string'";
$result=mysql_query($query);
$num=mysql_num_rows($result);
to work if $string is either Women's or Men & Women in the db?
Is there a way, without changing the data in the database, to make MySQL see Women's as Women%27s while allowing all other strings without this problem to work?
Or is there a better way entirely that I'm not seeing to get:
$query="SELECT * FROM db WHERE CATEGORY = '$string'";
$result=mysql_query($query);
$num=mysql_num_rows($result);
to work if $string is either Women's or Men & Women in the db?