how to pass data to view?? |
[eluser]yudahebat[/eluser]
what wrong with this controller?? I have a controller like this Code: <?php and my view like this Code: <html> My problem is why if I call choose_data by the URL http://localhost/ci2/test/choose_data/15 its didn't display anything??
[eluser]Thorpe Obazee[/eluser]
it won't. index doesn't have anything to produce. your variables do not have anything in them. try function index($data) { // your index method code }
[eluser]yudahebat[/eluser]
I try your command it still display nothing I think my problem is index function sets a bunch of variables to ‘’ but if I didn't it $tanggal $nama $isi will not define.. do you have any idea to fix it??
[eluser]Thorpe Obazee[/eluser]
errr.. you really should read the user_guide. that's what you need to put if you want to assign it to a variable. Code: $data['tanggal'] = $data->yourtablefield;
[eluser]yudahebat[/eluser]
Do you mean like this Code: <?php its still error Code: A PHP Error was encountered Im sorry Im newbie, I dont really understand about passing data please your help..
[eluser]Thorpe Obazee[/eluser]
Code: <?php Code: <html>
[eluser]Colin Williams[/eluser]
I'm guessing this is a repost? yudahebat, you might want to get your footing in basic PHP scripting. As has been demonstrating, you don't seem to have a problem using the CI framework as much as you do understanding how to move variables around in a script.
[eluser]yudahebat[/eluser]
I test with http://localhost/ci2/test/choose_data/15 and the result is Fatal error: Cannot use object of type stdClass as array in C:\xampp\htdocs\CI2\system\application\controllers\test.php on line 11 what is wrong??
[eluser]Thorpe Obazee[/eluser]
[quote author="Colin Williams" date="1238749673"]I'm guessing this is a repost? yudahebat, you might want to get your footing in basic PHP scripting. As has been demonstrating, you don't seem to have a problem using the CI framework as much as you do understanding how to move variables around in a script.[/quote] yeah, I agree. yudahebat, you probably don't have those fields in the db.
[eluser]missionsix[/eluser]
you can't interexchange objects and arrays, as you are doing in this example: Code: <?php You should either be returning a row as an array with row_array(), or choosing a different variable name. Code: <?php |
Welcome Guest, Not a member yet? Register Sign In |