• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Uri Class problem

hi all i have a controller (downloads.php) with this function (templates) after the main index():
function templates()
                    case "1":
                        $tab = "tab1";
                    case "2":
                        $tab = "tab2";
                    case "3":
                        $tab ="tab3";

my links are

so they took me rightly to /index.php/downloads/templates/3 ...as i want

but,when i click the link ,loading the view,i take this error:
Message: Undefined variable: tab_form_uri

i can't find any error,i've prooved also changing uri->segment(3) to uri->segment(4)......this is not the problem i guess Smile

any suggestions?

It probably also tells you where PHP has detected this undefined variable? Because that one isn't used in your code segment, you use $tab_from_uri, and not $tab_form_uri...

oh my god!!!!!!!!!!!!! sorry!!!!!!! ahahahah what i stupid i am!!!

really sorry Big Grin ,sometimes i would like to kill myself Big Grin eheheh

sorry for another question

when i take


and insert this into a db, is this prep from the helper or i need to escape it after:
$data['data_from_uri']=mysql_real_escape_string($this->uri->segment()); (for example)


really thanks man Wink

Depends on how you insert it. If you use Active Record everything will be escaped for you, unless you disable it.
The manual (have you read it? Wink) is very clear about this.

yes man,i understand ,and i always use active records to running queries, but i don't mind what you mean with disable escape on active record class? how do you disable escapes in this?
i can't find any suggest on active records guide on this argument ... Sad i guess i'm blind Tongue

and what about uri-segment()? is this automaticly escaped or not?

really thanks again Wink

As per the manual:
Quote:If you are using a database that CodeIgniter escapes queries for, you can prevent escaping content by passing an optional third argument, and setting it to FALSE.

uri->segment() is a retrieval function, there is nothing to escape.

pardon me Wan i'm new on PHP imn general and on CI's to Tongue

so if i don't specify any third parameter in active class the data are escaped automaticly?right?

thanks again Wink

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.