demon_athens Posted May 29, 2009 Share Posted May 29, 2009 I am really stuck here. I have this script $tt = "Α\' threemonth"; $results = "SELECT * FROM `content` WHERE `sname` = '$tt' "; // echo "query= ".$results; $results = @mysql_query ($results) or die(mysql_error()); $row_results = mysql_fetch_assoc($results); $totalRows_results = mysql_num_rows($results); echo "<br><br>FOUND ".$totalRows_results; problem is that I get 0 results although I have at least one. The "\'" is causing the trouble. I have exactly the same in my database "Α\' threemonth". How I can make this query works? Quote Link to comment Share on other sites More sharing options...
gevans Posted May 29, 2009 Share Posted May 29, 2009 Have you tried running the query in phpMyAdmin (if available) with the string written in. See if you get a result that way. If the original string was added using mysql_real_escape_string() use the same function on your string before attempting to query the db, rather than just putting the single quote in place. Quote Link to comment Share on other sites More sharing options...
Zhadus Posted May 29, 2009 Share Posted May 29, 2009 $tt = "A\\' threemonth"; Quote Link to comment Share on other sites More sharing options...
demon_athens Posted May 29, 2009 Author Share Posted May 29, 2009 I tried all this. I really can't understand this. I have enabled error_reporting but its clear of errors. Anyway I tried to see how phpmyadmin creates the php query. Look at this! $sql = 'SELECT * FROM `content` WHERE `sname` = CONVERT(_utf8 \'Α\\\\\'\' threemonth\' USING greek) COLLATE greek_general_ci'; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.