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

  • SEARCH
  • Home
  • 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 1103813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:23:37+00:00 2026-05-17T01:23:37+00:00

I want a wizard where I insert the database connection, and with some settings

  • 0

I want a wizard where I insert the database connection, and with some settings it generates the PHP classes. The wizard can use (internally) a template already created.

Is that posible? Does that already exists? If not, any ideas of how to do it?

Thanks!

Edit

I’m looking for something wich let me make my own class template or set it up.

  • 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-17T01:23:37+00:00Added an answer on May 17, 2026 at 1:23 am

    NetBeans rocks!

    NetBeans has strong MySql support, however, there are no native tools to generate classes from tables.

    There is a plug-in called db2php, check it out here. It will allow you to generate classes, basically ORM. Great if you are not using frameworks. If you are using Zend framework, search Zend Framework support on NetBeans site or right click project and go to Zend -> Run Zend Command.

    Also, for easy connections and code generation use ALT + Insert, saves a lot of time. The context changes depending on what is defined in you document.


    Edit on Oct 1, 2010

    There is no software out there that has custom templating system for database table creation. People try to convert to more standardized and sql free way, in other words ORM. Doctrine is one of them, but there is learning curve.

    Solution # 1

    You might want to look into standard NetBeans templating system. If you go to [Tools->Templates->Under PHP Section] you will be able to add templates and then create new classes from your the template via [Right Click->New -> Other -> Your Template]. Extending PHP Class might do it for you. Here is Sun’s blog showing how to use templates, also do a little searching on Google.

    Solution # 2

    Inheritance might be the answer for you. Create BaseTable that has the connection and common methods, then create ChildTable that enherits (extends) from BaseTable.

    You can create Data Access Layer (DAL) to create common data access methods or create Table objects.

    Below is an example of DAL

    abstract class DALBase {
    
        /**
         * Database connection
         * @var <type>
         */
        protected $_connection = null;
        /**
         * Name of table
         * @var string
         */
        protected $_tbl = null;
        /**
         * Name of primary key column
         * @var string
         */
        protected $_key = null;
    
        /**
         * Default Init
         */
        public function __construct() {
            $this->_tbl = 'table_name';
            $this->_key = 'primary_key';
        }
    
        /**
         * Gets the connection
         * 
         * @return <type>
         */
        private function _getConnection() {
            if (!$this->_connection) {
                $this->_connection = mysqli_connect('localhost', 'zend101', '', 'zend101', '3306');
                if (!$this->_connection) {
                    throw new Exception('Could not connect to MySQL: ' . mysqli_connect_error());
                }
            }
    
            //
            return $this->_connection;
        }
    
        /**
         * Executes the query
         */
        public function executeQuery($query) {
            $conn = $this->_getConnection();
            return mysqli_query($conn, $query);
        }
    
        /**
         * Loads item by primary key
         * 
         * @param mixed $id
         * @return object
         */
        public function getByID($id) {
            //
            $query = "SELECT * FROM $this->_tbl WHERE $this->_key = $id";
    
            //
            $conn = $this->_getConnection();
            $result = $this->executeQuery($query);
    
            //
            $item = mysql_fetch_object($query);
    
            //
            return $item;
        }
    
        /**
         * Loads a list
         *
         * @return array
         */
        public function loadList() {
    
            //
            $data = array();
    
            //
            $result = $this->executeQuery("SELECT * FROM $this->_tbl");
            if ($result) {
                //  Scan through the resource
                while ($row = mysql_fetch_object($result)) {
                    //  put row object into the array
                    $data[] = $row;
                }
            }
    
            //
            return $data;
        }
    
    }
    
    /**
     * Car table
     */
    class DALCar extends DALBase {
    
        /**
         *
         */
        public function __construct() {
            $this->_tbl = 'car';
            $this->_key = 'vin';
        }
    
    }
    
    /**
     * Client table
     */
    class DALClient extends DALBase {
    
        /**
         *
         */
        public function __construct() {
            $this->_tbl = 'client';
            $this->_key = 'id';
        }
    
    }
    
    //  Usage
    $dal = new DALClient();
    $clients = $dal->loadList();
    $client1 = $dal->getByID(1);
    $client5 = $dal->getByID(5);
    

    You can rewrite the parent class and make it table generic where you have all your fields and save method, delete method, etc… and then child classes will extend it and make it table specific.
    It is not a good practice to copy your code, use template everywhere. It is better to extend classes, if you decide to make a change you will have to change it in 1 place. But if you have dozens of tables and you used template, you might need to do dozens of changes.

    Just run into an interesting topic, might help you Which database patterns (ORM, DAO, Active Record, etc.) to use for small/medium projects?

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

Sidebar

Related Questions

My application has a wizard with some steps used to export data. I want
I want to write a wizard in .net which programmatically generates Visual Studio Solution
I Want some samples for step by step registrations like a wizard. i want
I want to use Primefaces to display a wizard pretty much similar to the
I want to create a custom project template with wizard i.e. when I create
I want to pass different template in each step for my django form wizard.
I just want to put some values from my database on an A4 page
I want to create a custom Visual Studio Project Template. Can I read the
I want to implement a wizard using winforms and VS 2010. I've got this
I want to create a wizard that includes a few steps, that in the

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.