Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5937577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:33:40+00:00 2026-05-22T15:33:40+00:00

I am newbie to class and objects.Here I am making an application for invoice.So

  • 0

I am newbie to class and objects.Here I am making an application for invoice.So for the controllers as in the frameworks I have taken them as handlers.So for the UserHandler
I have made this query:

<?php
class UserHandler {
  public $db;
  public function __construct($db) {
    $this->db = $db;
  }
  public function index() {
    print_r($this->db->query("SELECT * FROM nt_user"));
  }
 }

It is showing result in array as I want like that.

Array ( [0] => 1 [id] => 1 [1] => xyz [name] => xyz [2] => 5d6305f2 [password] => 5d6305f2 [3] => 2011-05-24 14:59:17 [created_at] => 2011-05-24 14:59:17 [4] => 2011-05-24 14:59:17 [updated_at] => 2011-05-24 14:59:17 ) 

Now I want to show that result in a view template.As view template is another file how to render all the values of handlers to the view.
I want the view page show like this:

name:
Password:

just like the login box.So please tell me how to do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:33:41+00:00Added an answer on May 22, 2026 at 3:33 pm

    You can create a static class using magic methods __get and __set to the the values like:

    class Data {
    
        public static $atributos = array();
    
        public function __get($chave) {
            return array_key_exists($chave, $this->atributos) ? $this->atributos[$chave] : NULL;
        }
    
        public function __set($chave, $valor) {
            $this->atributos[$chave] = $valor;
        }
    
    }
    

    To set a value, you use: Data::__set('view_data', $my_var);

    On the view you just do: Data::__get('view_data');

    I think it will work =)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi (huge Rails newbie here), I have the following models: class Shop < ActiveRecord::Base
Newbie question. I have a NSMutableArray that holds multiple objects (objects that stores Bezier
Java Newbie here. I have a JFrame that I added to my netbeans project,
I'm an Eclipse newbie and I'm trying to build a mixed AWT/SWT application. Here's
Okay, newbie multi-threading question: I have a Singleton class. The class has a Static
I am a newbie. Using class clsMRDateTime and am creating 2 instances of objects
Total newbie to R here (so far very pleased!). I have a large array(vector?)
Newbie here...can I write one program which incorporates .NET LINQ and also various Java
.NET newbie here... I'd like to make a button in a Windows form that
I'm a newbie to pgsql. I have few questionss on it: 1) I know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.