Jump to content

Problem with select query!


demon_athens

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/160149-problem-with-select-query/
Share on other sites

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.

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';

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.