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 8836875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:35:30+00:00 2026-06-14T09:35:30+00:00

In Joomla 2.5 and 3.0 I am able to get the database result set

  • 0

In Joomla 2.5 and 3.0 I am able to get the database result set as an array. Is it possible to convert this array as sql insert statement or .sql file so that the same can be used to insert in another table of same structure in another database?

  • 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-06-14T09:35:31+00:00Added an answer on June 14, 2026 at 9:35 am

    Yes you can, Check the code below. You can use the Joomla core function to get this done.

    1st initialize a data set as below.

    function initializesData()
        {
            $this->_data->id        = 0;
            $this->_data->field1    = '';        
            $this->_data->field2    = '';
            $this->_data->field3    = 1;
    
            return $this->_data;
        }
    

    Then load the row into the data set as below.

    function &getOne($id='')
        {
            $db =& JFactory::getDBO();       
            $query  = $db->getQuery(true);
            $query->select('*');
            $query->from($db->nameQuote(TABLE_PREFIX.'table_name'));
            $query->where($db->nameQuote('id').'='.$db->Quote($id));       
            $db->setQuery($query);      
            $this->_data = $db->loadObject();
    
            if ($this->_data)
            {      
                return $this->_data;
            }
    
        }
    

    Then insert the row using Joomla tables.

     function store()
        {  
           //Get post data 
           $this->_data = $this->getOne($id);
    
    
           $row = &$this->getTable('table_name');
    
    
           if (!$row->bind($this->_data))
           {
              $this->setError($this->_db->getErrorMsg());          
              return false;
           } 
    
    
           if (!$row->check())
           {         
             $this->setError($this->_db->getErrorMsg());
             return false;
           } 
    
    
           if (!$row->store())
           {
             $this->setError($this->_db->getErrorMsg());
             return false;
           }      
           $new_id = $this->_db->insertId();
    
           if($new_id > 0)
                $this->_data->id = $new_id;
    
           return true;
        }
    

    All above functions are in the model. Hope you can manage function calls in the controller. If you want to do multiple insertions loops the function calls. If you have any issue let me know

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

Sidebar

Related Questions

I am able to upload file in joomla. I want to know if the
Since Joomla 2.5 supports PostgreSQL natively and we're very in favour of that one.
In Joomla 1.5 I would like to have a startpage (that has its own
In Joomla 1.5, you can set modules to display on certain menus and not
I install Joomla 2.5.4 plugin System - Twitter Roll and set basic configuration which
http://localhost/joomla/administrator/ The web browser returns an error that the page does not exist after
I have created web-application using Joomla 2.5. In that I have used Joomla user
On my PHP-based (Joomla!) site users should be able to provide a photo of
I used Joomla 1.5 for a site that I developed for a gaming company.
I'm trying to fetch query results from Joomla MySQL database in a Joomla page.

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.