Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear my friends,

I meet a problem.
PHP
$query = $this->db->query("SELECT p_endgrid_i('".$date."','".$cb_line."','".$cb_model."','".$cb_process."','".$url_item."');");

The data of $url_item has '()',i don't know why they are changed to '& #40;& #41;' in process of MySQL.
I try many times,i found it isn't CI function and mysql problem.
And echo $url_item is nomarl in html page.
Now i don't know how to solution this problem,and i want to know why it happen?

Plz help!
Thank you very much!

--------------------------------------------------------------
2014/12/02

I found it maybe is recognized as a character or array.
Now,I use the following way to solution my problem.
$url_temp3 = str_replace("& #40;","(",$url_temp2);
$url_item = str_replace("& #41;",")",$url_temp3);

I want to know another right way, i think it is a temporary method.
And i want to know why so much!

Thank you my friends!
Posted
Updated 1-Dec-14 19:26pm
v2
Comments
Sinisa Hajnal 1-Dec-14 3:37am    
There is no problem. ( and 41 are HTML codes for ( and ) and perfectly valid in URL. Similar would be space () and multiple other "special" characters.

As to how to get them in your code without encoding...I have no idea :) Sorry.
aolin.wang 1-Dec-14 3:49am    
Thank you all the same!

1 solution

The value of @url_item passed across the web and was encoded to prevent problems of injection and language and more...
If you want to send it in it's unencoded format to MySQL (why? why not save it as is?) you may use PHP's urldecode[^] method...
 
Share this answer
 
Comments
aolin.wang 1-Dec-14 8:19am    
Hi,Peter.
Thank you for your help.
The urldecode method can't help me. it can change '%20' to blank .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900