Setting Django up to use MySQL

MySQL support is simple to add. In your DATABASES dictionary, you will have an entry like this: You also have the option of utilizing MySQL option files, as of Django 1.7. You can accomplish this by setting your DATABASES array like so: You also need to create the /path/to/my.cnf file with similar settings from above With this new method of connecting in Django … Read more

Incorrect string value: ‘\xEF\xBF\xBD’ for column

\xEF\xBF\xBD is the UTF-8 encoding for the unicode character U+FFFD. This is a special character, also known as the “Replacement character”. A quote from the wikipedia page about the special unicode characters: The replacement character � (often a black diamond with a white question mark) is a symbol found in the Unicode standard at codepoint U+FFFD in the … Read more

PDO with INSERT INTO through prepared statements

You should be using it like so Prepared statements are used to sanitize your input, and to do that you can use :foo without any single quotes within the SQL to bind variables, and then in the execute() function you pass in an associative array of the variables you defined in the SQL statement. You may also use ? instead of :foo and then pass in … Read more