Welcome Guest, Not a member yet? Register   Sign In
Litle problem with big Variable
#1

[eluser]PAstorKill[/eluser]
:exclaim:

Help me please? I am studying PHP only 2 month.
I don't have a person that could help. And I've never seen any frameworks, except CI.

When I wrote in my mainpage controller:

$data= array;
&data;['main_info']=$this->db->get($page_id);

it get me an error with the text below :

Undefined variable: page_id in

A have already switched the level of errors to lower, but still it doesn't work.



What's this all about?

P.S. : I'm from Ukraine, sorry for some troubles in English, that you might have note!!!
Thanks for help.
#2

[eluser]temon[/eluser]
your $page_id variable is undefined.

try it first

echo $page_id;

if nothing print in your browser, you must defined the $page_id first, try example

$page_id = 1;
#3

[eluser]PAstorKill[/eluser]
What I was trying to do is ...

I've tried to get the array of data from my SQL table.

Function "get" situated in model with name"crud" which extends CI_Model.

$page_id should get the info based on the query string that contain ciru2.ru/pages/show/index
I wanted $page_id to have "index" on it!!!


after those movements I've wrote

switch($page_id)

case:'index'
{
.............
.......
..
}
#4

[eluser]temon[/eluser]
try

echo $page_id;

and what happening??
#5

[eluser]PAstorKill[/eluser]
Thanks for the advice. I on my work right now. When get back home - I'll write what I get, cause my project is in my laptop.
#6

[eluser]PAstorKill[/eluser]
Thank you "temon"... thank you a lot. I solved problem. But this was not even a problem , it was my inattentiveness )))

the row public function get()
{
}

should be

public function($page_id)
{
}

and construction switch case then works...


Sorry, I am beginner ... Lol
#7

[eluser]PAstorKill[/eluser]
ci2.ru/page1/show/index...

and in public function show($page_id)
switch ('page_id')
case 'index':
$this->db->tables->get($page_id)
.....................
...............
#8

[eluser]temon[/eluser]
ha ha ha, you'r welcome!

you must give a complete code, if you want ask some think Big Grin




Theme © iAndrew 2016 - Forum software by © MyBB