MySQL Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation ‘Concat’

Standard

Recently fall on the problem below:

collations

The quick solution here:
1. Open phpMyAdmin, then go to database table where data come from. Click on structure tab on phpMyAdmin for selected table like below:

collations

2. On the top image you will see on Collation row. Here first_name Collation set to utf8_general_ci and last_name Collation set to utf32_general_ci.

When I have change last_name Collation to utf8_general_ci like below the problem solved.

collation_fix

MySQL Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation ‘Concat’

Standard

Recently fall on the problem below:

collations

The quick solution here:
1. Open phpMyAdmin, then go to database table where data come from. Click on structure tab on phpMyAdmin for selected table like below:

collations

2. On the top image you will see on Collation row. Here first_name Collation set to utf8_general_ci and last_name Collation set to utf32_general_ci.

When I have change last_name Collation to utf8_general_ci like below the problem solved.

collation_fix

“The URI you submitted has disallowed characters.” CI Poblem Now Solved

Standard

When setup an CI application on my localhost its successfully install. But application links that use application route does not work. It show “The URI you submitted has disallowed characters.” error message. After googling the problem find that its PHP version related problem, you can also say that a CI version problem. But what is it not matter, I need to fix the bug and time is short. So its simple solution we can try:

As my application CI version is 1.7 do the following:

=> Go to system/libraries/URI.php

When open URI.php go to line 189 and you will find below:
if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", rawurlencode($str)))

Change it to below:
if ( ! preg_match("|^[".($this->config->item('permitted_uri_chars'))."]+$|i", rawurlencode($str)))

=> Then go to system/application/config/config.php

Open the file config.php and go to line 126 and you will find below :
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-';

Change it to below:
$config['permitted_uri_chars'] = 'a-z 0-9~%\.\:_\-';

Now our problem fix. The application run ok.

A series solutions of Codeigniter version errors

Standard

In the article I am going to post some solutions of well-known Codeigniter errors. These errors list are here:

1. When you run an old codeigniter applications in new version localhost server (PHP5.x, MySQL5, Xampp7.2 ) it shows blank page known as white skin (?screen) of death.

2. Shows the error message “The URI you submitted has disallowed characters”

3. Shows the error message “Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\ci\system\……….php on line ……”

If you see any of the errors, follow these steps one after another. May be it could help you to run your Codeigniter applications without errors.

Solutions:

First check is your Codeigniter version is new or old. To do this, go to ci_applicationname/system/codeigniter folder. Open CodeIgniter.php file. On the top of the file find-out these two lines:

// CI Version
define('CI_VERSION', '1.6.3');

If it shows older Codeigniter version then download a Latest Codeigniter from here.
What will you do now? Unzip the new CI version and go to system folder. In system folder copy codeigniter, database, helpers, language, libraries, scaffolding, plugins all these folder. Place/Paste these folders in your old Codeigniter application system folder. Please backup your old CI apps before do any change. Now again go to new version of Codeigniter, and go to system/application/config folder and copy the file constants.php file and paste it in your old Codeigniter application same directed folder. Now your CI version up-gradation done. Ok now going to solve some common problems.

Open the index.php file located in your application folder root. Find out this two line:
//error_reporting(E_ALL);
error_reporting(E_ERROR&~E_NOTICE);

Reverse the code, mean remove comment tag from first line and place comment tag in second line like followings:
error_reporting(E_ALL);
//error_reporting(E_ERROR&~E_NOTICE);

Now run your application on your localhost. It will show all error if any file/folder missing. Fix that by place those files/folders on that specified location from other running CI apps or from new CI version.

If you see this message “The URI you submitted has disallowed characters” do the followings:
Go to your application system/libraries and open the file URI.php. At line 189 or like something this you will see this:
if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", rawurlencode($str)))
and replace that by this
if ( ! preg_match("|^[".($this->config->item('permitted_uri_chars'))."]+$|i", rawurlencode($str)))
or by this
if ( ! preg_match("|^[".str_replace('\\-', '-', preg_quote ($this->config->item('permitted_uri_chars')))."]+$|i", $str))

And go to your application system/application/config folder and open config.php file and go to line 126 or something like that, you will see this $config['permitted_uri_chars'] = 'a-z 0-9~%.:_-'; and replace this by $config['permitted_uri_chars'] = 'a-z 0-9~%\.\:_\-';

Now the error “The URI you submitted has disallowed characters” may be fixed.

Till your application show error? It may be look like this “Deprecated: Assigning the return value of new by reference is deprecated in ….php on line …”. What now? Yeah! I like to solve the bugs by dirty way. Again Open the index.php file located in your application folder root. Find out this two line:

error_reporting(E_ALL);
//error_reporting(E_ERROR&~E_NOTICE);

Now again reverse the code, mean remove comment tag from second line and place comment tag in first line like followings:
//error_reporting(E_ALL);
error_reporting(E_ERROR&~E_NOTICE);

Now go to http://localhost/your_apps and run apps. Hope all errors are fix now.

Implement Google Calendar in Your Website

Standard

For one of my project I need to implement Google Event Calendar in my CMS. First time I thought its may be complicated. But its not. See this:

Step1: First you need a Google service account. If you already have Google account for Gmail or any other Google service then you can use that account ID, in that case you do not need any new account.

Step2: Login to Google Calendar by this http://www.google.com/calendar

Step3: After login you will see a default event calendar according to your account ID. To navigate other or create a new calendar go to screen left side My Calendars Panel Box. For create new calendar, click on create. For navigate other calendar you have to click on any one from the list of all your calendars. From list select your preferred calendar. After select your preferred calendar navigate to the calendar settings by click on small array. After click on small array you will see a drop down list. Click on Calendar Settings. You will see your preferred calendar settings. Here also you will see a block with titled Embed This Calendar. Copy the iframe code from here and paste the code on you required CMS page. All done.
[Note: Dont forget to set you calendar public from calendar settings, to access the calendar without login.]