codeigniter issues with DB and special characters |
Hi guys
i am using an app in php which was designed and using codeigniter 1.7.xx version i think i have an issue regarding charset and i am kind of lots perhaps someone might help me i am tryint to find for URLencode and decode functions on codeigniter. i have an issue regarding the following plaintext which gets stored on my mysql db as special character. so first things first on codeignite i have setup my db charset on UTF-8 config.php $config['charset'] = "UTF-8"; database.php $db['default']['char_set'] = "utf8"; $db['default']['dbcollat'] = "utf8_general_ci"; also i have tried db with latin1 and latin1_general_ci and on mysql db in have all sql db now changed to utf8_genral_ci and i have also tested in in latin1 my problem is the following i have a config webgui page in php which collects the input data for a autoconfiguration file it gets generated.. this autoconfiguration options is an option which selects specific data unique from each device tunner so this is my config example Auto_ipv4 = 239.106.%card.%number this %card and %number are data input from specific hardware unique data.. on my device console it works great.. but on the webgui php when i press write to store this on the database it gets stored as 239.106.?rd.%number because it classifies this %ca as special character ? so how can i changet this in order to make it interpreter as a simple text input data to store it on my mysql db ? is there a solution for this? i am kind of lost any help would be appreciated.. i have the folloowing code on /controllers config.php PHP Code: <?php This is the export.php code PHP Code: <?php PHP Code: <?php if (isset($user_msg['status'])): ?> PHP Code: <?php if (isset($user_msg['status'])): ?> Basically i just need to store this data without beeing fetched as special character just as plain text. any help will be appreciated Thxs PortalNET
Hiya
Looks like this is the part where i need to check first the plain text to avoid storing it as special character Quote:elseif ($status == 'valid') {
Ok so far i have tested and found this is the problem with this special char
%ca , it output and stores it on my mysql as ? and when i try to make the output of it from mysql it stores it also on the value as ? instead of %ca any ideas or help on this i have my db mysql and all codeigniter config set to UTF-8 and db utf8_unicode_ci and also teste on uft8_general_ci
try escaping it ( \%ca or \\%ca )
See if that will work for it. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
In your sql queries.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(05-10-2018, 04:20 AM)InsiteFX Wrote: In your sql queries. yup i have added the escap string in the sql driver.. PHP Code: // escape LIKE condition wildcards after saved, i reboot the db, and when i insert 239.106.%card.%number and save the txt data into my db it not stores only 239.106 no other data copied into the db so it completelly wipes the data %card.%number
Not in the sql driver in the sql query that you create to send to the database.
Try with one / or two // Also did you try doing this? CodeIgniter User's Guide - Escaping Queries What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |