I have a php code with a string that I'm trying to find in an MySql database.
But...I'm getting empty result set.

The database has a varchar column named news_url with this in it "/is/frettir/titill".

What I'm trying to do is search for this row with that string in the db.

I have a string variable in php

$curl = "/is/frettir/titill";

and this query:

SELECT * FROM news WHERE news_url LIKE '$curl'
(SELECT * FROM news WHERE news_url LIKE '/is/frettir/titill/')

I'm trying to find exactly that string. Not something like "/is/frettir/titill/morestuff" or "/is/frettir/" so what am I doing wrong? :/

5 Years
Discussion Span
Last Post by pritaeas
$query = "SELECT * FROM news WHERE news_url = '$curl'";

thanks pritaeas but I already tried that...still just get empty record set..


Yea tried that in phpmyadmin too with same results :/ kinda strange...
Might be something with the forward slashes. Will try to make another record without one just to test it.


hum I'm onto something here.. when I added a record with the text "testtest" (no forward slashes) and I got results.
So I am assuming it has something to do with formatting the search then.


I have no problems selecting this. Perhaps you have an older mysql version ? I've seen many forum posts with similar issues.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.