Welcome Guest, Not a member yet? Register   Sign In
array frustration : ripping hair out
#7

[eluser]Tom Schlick[/eluser]
yes i am sure when i did print_r($data) before it would print out the entire array of data

the feild title is 'name' the only thing in the field that is capitalized is the ID feild.

here is my controller again
Code:
<?php

class Games extends Controller {

    function Games()
    {
        parent::Controller();
        $this->load->library('games_library');    
    }
    
    function index()
    {
        $this->load->view('games/games_home.php');
    }
    
    function play($game_id, $game_name = '')
    {
        $data['games_result'] = $this->games_library->renderGameData($game_id);
        $this->load->view('games/games_play.php', $data);
    }
}
?>

and here is the view

Code:
<?php

print($games_result->name);
?>

nothing changed in these but here is the library...

Code:
<?php

class Games_library
{

    function Games_library()
    {
        $this->CI =& get_instance();
        $this->CI->load->model('games_model', '', TRUE);    // Start up the trusty database shit
    }
    
    public function renderGameData($game)
    {
        
        if(is_numeric($game))
        {
            $result = $this->CI->games_model->getGameData($game);
            return $result;
        }
        else
        {
            redirect("errors/404");
        }
    }

}

?>

and here is the model
Code:
<?php

class Games_model extends Model {

    function Games_model()
    {
        parent::Model();
    }
    
    function getGameData($game)
    {
        $query = $this->db->query("SELECT * FROM `game_games` WHERE ID = '$game' LIMIT 1");
        return $query->result();
    }
}

?>


Messages In This Thread
array frustration : ripping hair out - by El Forum - 07-29-2008, 09:52 AM
array frustration : ripping hair out - by El Forum - 07-29-2008, 10:23 AM
array frustration : ripping hair out - by El Forum - 07-29-2008, 10:28 AM
array frustration : ripping hair out - by El Forum - 07-29-2008, 10:30 AM
array frustration : ripping hair out - by El Forum - 07-29-2008, 10:35 AM
array frustration : ripping hair out - by El Forum - 07-29-2008, 10:50 AM
array frustration : ripping hair out - by El Forum - 07-29-2008, 10:57 AM
array frustration : ripping hair out - by El Forum - 07-29-2008, 11:07 AM
array frustration : ripping hair out - by El Forum - 07-29-2008, 11:08 AM
array frustration : ripping hair out - by El Forum - 07-29-2008, 11:09 AM
array frustration : ripping hair out - by El Forum - 07-29-2008, 11:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB