Results 1 to 9 of 9
Nov 25, 2010, 02:35 #1
- Join Date
- Nov 2010
- 0 Post(s)
- 0 Thread(s)
How can "Some String" != "Some String" ?
I'm building a website that allows members to upload images.
The images themselves are not stored in the database - just the image information
(id, title, filename, thumbnail, date, ownerid).
I created small test tables in PHPMyAdmin, and everything was working fine until I got my image upload script working.
Apparently, SQL doesn't recognize strings that are inserted by my script.
In other words:
SELECT * FROM 'image' Returns all recordsCode:
SELECT * FROM 'image' WHERE 'title' LIKE "Some Title" Returns the row with "Some Title" if it was inserted by PHPMyAdmin.Code:
SELECT * FROM 'image' WHERE 'title' LIKE "Some Title" Returns 0 records if "Some Title" was inserted through my PHP script.Code:
If I copy and paste or type the words "Some Title" in PHPMYAdmin: SELECT * FROM 'image' WHERE 'title' LIKE "Some Title" Now returns the correct data.
"Some Title" != "Some Title" for some mysterious reason.
Incidentally, all of the other rows with strings have the same issue.
Here's what I've tried:
SHOW CREATE TABLE: CREATE TABLE `image` (`id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `filename` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `thumbnail` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `date` date NOT NULL, `ownerid` int(11) DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=43 DEFAULT CHARSET=utf8 COLLATE=utf8_binCode:
SHOW CREATE DATABASE: CREATE DATABASE `imagedb` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */Code:
Of course, when I connect to my database, I always run: !mysqli_set_charset($link, 'utf8')Code:
All of my html and php pages contain: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">Code:
Someone suggested putting this at the top of my script: ini_set('default_charset', 'UTF-8'); It didn't help, so I removed it.
setting the collation for each column manually.
I also tried running this script: SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'
But I'm stumped, so any help would be appreciated!