Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

Copy data from to table

Locked
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Copy data from to table

Unread post by ruiascensao »

Hi,

I have a table that has model details:
standard_details.jpg
When I create a new unit I copy this details to the unidetails table:

Code: Select all

$ut  = nuRunQuery("SELECT * FROM giga_mod_detail WHERE mdetail_id = '$modelID'");

    while($row1 = db_fetch_object($ut)){
	$detailnum = $row1->mod_detail_num;
	$accessory = $row1->mod_detail_name;
	$modtype = $row1->mod_type_id;
	$newrecordID = uniqid('1');
   
	$sql  = "INSERT INTO giga_udetails (";
	$sql .= "giga_udetails_id, udetails_unit_id, udetails_num, udetails_name, udetais_mo_id, udetails_type_id) ";
	$sql .= "VALUES ( ";
	$sql .= "'$newrecordID','$recordID','$detailnum','$accessory','$modelID','$modtype')";
	nuRunQuery($sql);
        nuRunQuery("INSERT INTO acc_counter (acc_text) VALUES ('1')");

        $t  = "UPDATE giga_udetails SET udetails_code = '" . mysql_insert_id() . "' ";
        $t .= "WHERE giga_udetails_id = '$newrecordID'";
        nuRunQuery($t);
   }
The problem is that I'm getting blank records:
unitdetails.jpg
Any idea what is the problem?

Thank You!,
Rui
You do not have the required permissions to view the files attached to this post.
BR
Rui
shane
Posts: 100
Joined: Mon Jun 15, 2009 10:04 am

Re: Copy data from to table

Unread post by shane »

Sorry I cannot see the problem, it could be more data in the source than you are aware of?

Try echoing the response out to the screen as you do the look to see where this is happening
admin
Site Admin
Posts: 2824
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 29 times

Re: Copy data from to table

Unread post by admin »

rui,

You really need to learn how to debug your work.

If we were to help you, thats all we would do.

Steven
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Re: Copy data from to table

Unread post by ruiascensao »

Sorry Steven!

I solve this issue for now just deleting the rows with udetails_num=0.
I will usethe nuDebug() function to correct this.


Best Regards,
Rui
BR
Rui
admin
Site Admin
Posts: 2824
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 29 times

Re: Copy data from to table

Unread post by admin »

Good on you!

Steven
Locked