View not Recognizing the methods of the Model in PHP -


i'm able load model in view method inside model not recognized view. can point out on i'm going wrong. i'm using pip mvc framework http://gilbitron.github.io/pip/

p.s. i'm new mvc.

model.php

class model {  private $connection;  public function __construct() {     global $config;      $this->connection = mysql_pconnect($config['db_host'], $config['db_username'], $config['db_password']) or die('mysql error: '. mysql_error());     mysql_select_db($config['db_name'], $this->connection); }  public function execute($qry) {     $exec = mysql_query($qry) or die('mysql error: '. mysql_error());     return $exec; } 

my model

class listing_model extends model {   public function createnewjob($by) {            $result = $this->execute('insert job_listings (by_user_id) values ('.$by.')');     return $result;      } } 

controller:

function create() {           $template = $this->loadview('post_jobs_view');     $model = $this->loadmodel('listing_model');      $template->render();         } 

view:

if (isset($_post['savejob'])) {             $by_user_id = 1111;             listing_model::createnewjob($by_user_id);         } 

first off, haven't created static function, shouldn't calling statically. looks pip loads model instance variable.

$model = $this->loadmodel('listing_model');  $model->createnewjob($by_user_id); 

this brings me second point, code seems more fitting controller view. may want how logic should processed in mvc , code appropriate in view.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -