Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Question about Primary Key column

Locked
clinterman
Posts: 24
Joined: Thu Apr 05, 2012 7:53 am

Question about Primary Key column

Unread post 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.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Question about Primary Key column

Unread post 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
You do not have the required permissions to view the files attached to this post.
clinterman
Posts: 24
Joined: Thu Apr 05, 2012 7:53 am

Re: Question about Primary Key column

Unread post 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.
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Question about Primary Key column

Unread post 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
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Question about Primary Key column

Unread post by admin »

admin wrote:But make the name of the Display Object something other than the PK name.
clinterman
Posts: 24
Joined: Thu Apr 05, 2012 7:53 am

Re: Question about Primary Key column

Unread post 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.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Question about Primary Key column

Unread post by admin »

.
Locked