PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, February 19, 2022

[FIXED] Printing a variable value in a CodeIgniter model (basics)

 February 19, 2022     codeigniter, model-view-controller, php     No comments   

Issue

In Codeigniter, how can I verify the value of a variable, defined in a model? I am a newbie in CI and I searched the Documentation and Stackoverflow, and I couldn't find any information.

echo and print output don't print anything, like echo "Hello word"; print("hello world"); var_dump($array);


Solution

CodeIgniter is a MVC framework which means Model - View - Controller.

In such a Framework, you have:

  • your Model code to store/persist your data (and to access it),
  • your Controller code to manage the logic of your program,
  • and your views to display to the user the result.

In your case, you then need to pass your data from the model, to the controller and finally to your view to have an idea of the data stored. So try to pass your data to your view in order to var_dump it their.

EDIT:

You should go to the user guide written on the official website which explains really well how to make a simple example https://codeigniter.com/user_guide/index.html

Precisely:

  1. Basic Hello World in a controller
  2. Create your models
  3. Full example of a news section


Answered By - lucasfoufou
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing