tarenberg Posted September 11, 2006 Share Posted September 11, 2006 When I Post characters like ® and ™ to a SQL database from a PHP edit page ie:SQL string = INSERT INTO products (cat_id,product,pict,pict_path,description,notes,pl_no,web_no,settings,features,specs,pb,drawing,opt_acc,w_order,a_order,new) VALUES ("64","® ™ reg\'d","","","","","","","31","","","","","","","","")The resulting entry ends up being " [b]®[/b] " and " [b]â„¢[/b] ", but when I take the SQL statement:INSERT INTO products (cat_id,product,pict,pict_path,description,notes,pl_no,web_no,settings,features,specs,pb,drawing,opt_acc,w_order,a_order,new) VALUES ("64","® ™ reg\'d","","","","","","","31","","","","","","","","")and enter it into the database using phpMyAdmin the data is entered correctly, " [b]® ™[/b] ".Does anyone know how to eliminate this problem?Thanks in advanceTom Link to comment https://forums.phpfreaks.com/topic/20397-posting-characters-like-%C2%AE-and-%E2%84%A2-to-a-mysql-db-from-a-php-edit-page-gives-bad-res/ Share on other sites More sharing options...
Jenk Posted September 11, 2006 Share Posted September 11, 2006 you have encoding mismatches.btw - you don't need to specify every column when you do updates..[code]INSERT INTO products (cat_id,product,settings) VALUES ("64","® ™ reg\'d","31")[/code] Link to comment https://forums.phpfreaks.com/topic/20397-posting-characters-like-%C2%AE-and-%E2%84%A2-to-a-mysql-db-from-a-php-edit-page-gives-bad-res/#findComment-89848 Share on other sites More sharing options...
R_P Posted September 11, 2006 Share Posted September 11, 2006 Try changing the datatype and collation of the table columns you expect to have these characters entered into. Honestly, I'm not an expert on datatypes so you may want to do a little research. I do know there are characters MySQL doesn't take. Take a look here:http://www.xaprb.com/blog/2006/04/14/bad-character-data-in-mysql/Also, while you don't need to specify every column in and UPDATE, you do in an INSERT, unless you have a default value assigned to that column.Happy coding. Link to comment https://forums.phpfreaks.com/topic/20397-posting-characters-like-%C2%AE-and-%E2%84%A2-to-a-mysql-db-from-a-php-edit-page-gives-bad-res/#findComment-89853 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.