TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 11-11-2009, 10:24 AM   #1 (permalink)
The Acquainted
 
captainmerton's Avatar
 
Join Date: May 2009
Posts: 178
Thanks: 9
captainmerton is on a distinguished road
Default Mysql Character Sets

Anyone got any guidance on this?

I have developed a website on my local machine using an installation of MYSQL5. It has the following characater settings (which I now believe to be default):

character_set_client latin1
character_set_connection latin1
character_set_database latin1
character_set_filesystem binary
character_set_results latin1
character_set_server latin1
character_set_system utf8

When i deployed the website to a shared hosting server which has a MYSQL5 database also but different character settings the way the website handles escaped strings has changed. The character set settings on the hosted db are:

character_set_client utf8
character_set_connection utf8
character_set_database latin1
character_set_filesystem binary
character_set_results utf8
character_set_server latin1
character_set_system utf8

The issue I'm getting is that on the hosted db it isnt escaping strings the way i want it to.

Before i make the db call to insert a comment from a comment form i'm escaping things (or intending to) like commas etc:

PHP Code:
$this->commenttext $this->mysqli->real_escape_string($this->commenttext); 
On the local instance of the website a string such as "Jim's Comment" will be inserted as "Jim's Comment" but on the hosted db its inserted as "Jim\'s Comment". Thats just one example of the issues i'm having.

Questions I have are what are the implications of not using the default Mysql character set settings and if i was to reset my local machine to match the settings on the hosted service db how can I get the real_escape_string function to escape the relevant characters? Should my hosted service be reset to the dafault character set settings? Which way should I go?

Any help would be much appreciated as i've done a fair bit of reading on this but nothing thats got it clear in my head yet.
captainmerton is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using a MySQL class Andrew General 12 07-14-2009 03:49 PM
Securing your MySQL Queries with Sprintf Wildhoney General 26 03-18-2008 06:52 PM
MySQL Sell Up Alan @ CIT The Lounge 12 01-17-2008 05:46 PM
Error in connecting to MySQL via PHP EyeDentify MySQL & Databases 0 01-03-2008 01:06 PM
Notepage like application to open large MySQL files Wildhoney General 6 12-07-2007 02:18 PM


All times are GMT. The time now is 03:19 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design