Search code examples
mysqlstringsql-like

Why does this string comparision mysql query return nothing?


I execute the following:

SELECT url FROM mytable WHERE 1

result: url: 'http://www.ciao.es/Epson_Stylus_S22__2007613'

Everything ok by now...but when I do:

SELECT * FROM mytable WHERE url = 'http://www.ciao.es/Epson_Stylus_S22__2007613'

I get nothing!!!

I tried using LIKE, changing the quotes, etc... what am I doing wrong?


Solution

  • You are having ' ' in your table field url .So if you are querying you will get output like this: 'http://www.ciao.es/Epson_Stylus_S22__2007613' (with in single quote) SO Write in this way:

    SELECT * FROM mytable WHERE url = "'http://www.ciao.es/Epson_Stylus_S22__2007613'"
    

    Or remove single quote from table.