Jump to content


Photo

Posting characters like ® and ™ to a mySQL DB from a PHP edit page gives bad res


  • Please log in to reply
2 replies to this topic

#1 tarenberg

tarenberg
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 11 September 2006 - 03:00 PM

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 " ® " and " ™ ", 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, " ® ™ ".

Does anyone know how to eliminate this problem?

Thanks in advance
Tom

#2 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 11 September 2006 - 03:12 PM

you have encoding mismatches.

btw - you don't need to specify every column when you do updates..

INSERT INTO products (cat_id,product,settings) VALUES ("64","® ™ reg\'d","31")


#3 R_P

R_P
  • Members
  • PipPipPip
  • Advanced Member
  • 98 posts

Posted 11 September 2006 - 03:24 PM

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...-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.
Pro in: Win2K3S | Apache2 | PHP5 | Perl5 | MySQL | MSSQL | Firefox | Photoshop
Student of: Ubuntu6 | Java | C | VB.NET | ASP.NET
Developer: Roddzilla Webstudios, Burrson CG, DVIDSHUB, The Four Nations
Student: Georgia Tech, Georgia Tech College of Computing




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users