Page 1 of 1
Question about Primary Key column
Posted: Wed Jan 02, 2013 12:47 pm
by clinterman
I have a table Store with Primary Key ID auto-increment.
If I have the ID column on an edit screen while adding a record, the auto-increment doesn't work, it seems that nuBuilder pre-populate it with something.
If I get it off the screen it works fine.
I would love to have it on the screen with and normal auto-increment behaviour. How can I get this fixed?
How exactly would I be able to debug what is going on behind the scenes? I keep reading about nuDebug, but no screen popup. The button PHP Debug on the index screen is not showing all SQL statements, I'm not sure which records it does display and which it doesn't display.
Re: Question about Primary Key column
Posted: Wed Jan 02, 2013 10:55 pm
by admin
clinterman,
You can display the Primary Key with a Display Object.
Capture.PNG
But make the name of the Display Object something other than the PK name.
Steven
Re: Question about Primary Key column
Posted: Thu Jan 03, 2013 5:50 am
by clinterman
Steven,
I can see the ID on the screen now, but the record don't get saved.
this is in Before save: nuDebug("Before saving".$_POST['store_id']);
I have the output in PHP Debug: (nuBuilder Before Save) of (Wizard) reviews : Before saving492
So I expect a clean Insert into table reviews (store_id) values (492)
this is what mysql client does:
3-1-2013 5:42:45 0:00:00.002: 1 rows affected
1: insert into reviews (store_id) values (492)
I have no idea what is happening with it but it doesn't get inserted.
Can you explain more clearly where this might go wrong?
Or give the steps that I can take to see what statement nuBuilder is sending to mysql.
There must be a trace of how my expected insert into table (onefield) values (onevalue)
get to something that doesn't work.
Re: Question about Primary Key column
Posted: Thu Jan 03, 2013 10:28 pm
by massiws
clinterman,
maybe, have your display object the same name of pk field name (store_id)?
Try to change the name of display object to whatever else.
Max
Re: Question about Primary Key column
Posted: Fri Jan 04, 2013 12:11 am
by admin
admin wrote:But make the name of the Display Object something other than the PK name.
Re: Question about Primary Key column
Posted: Sat Jan 05, 2013 4:26 pm
by clinterman
Ok, I made a workaround to solve the matter. I needed 3 tables to get inserted after inserting a new store. I arranged that in an after_save on the store form. So that the store_review only need to update existing records. That works now. Thank you all for handing in inspiration. Yet I find it hard that I can not exactly see what nuBuilder does.
Re: Question about Primary Key column
Posted: Mon Jan 07, 2013 3:36 am
by admin
.