• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Best way to insert specific data from Existing Table into newly Created Table...

#1
[eluser]BoyBlue[/eluser]
Ok, so I'm officially feeling defeated with the current way I'm trying to insert specific data from an existing table into a newly created table...

(And, I've been getting AMAZING help from this forum in trying to solve it [InsiteFX you are a total stud for trying to save a flatlined summer-student!]; but I think I've screwed something up so badly that it's probably best for me to admit defeat and start over from scratch)


Here is my current "problem-code" in the Model for trying to insert specific data from an existing table("games") into a newly created table("$table_name"):
Code:
function get_game_data($table_name)
    {

        $this->db->select('game_id, base_number');//Table item(s)
        
        $game_data = $this->db->get('games');//name of table in database

        if ($game_data->num_rows > 0)
        {

        $this->db->select('game_id, base_number');//Table item(s)
        
        $this->db->insert($table_name, $game_data);//name of table in database and items to insert

        }
Can someone please point me in the right direction regarding the best markup you've found for inserting specific data from an existing table into a newly created table with no data in it.

thanks

#2
[eluser]InsiteFX[/eluser]
@BoyBlue

One other think that I was thinking about is it is possible that your data from the first table is not matching up to the data with your second table.

When doing something like what you are trying to do the data has to match both tables.

InsiteFX

#3
[eluser]toopay[/eluser]
How your database structure(and tables) looks like?

#4
[eluser]InsiteFX[/eluser]
@toopay

I had him list the tables in his other post, this is a new post from him.

InsiteFX


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.