Welcome to the nuBuilder Forums!

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

Adding Data directly to Database

Post Reply
nuMax
Posts: 2
Joined: Thu Jun 14, 2012 12:31 pm

Adding Data directly to Database

Unread post by nuMax »

Hello everybody,
i'm working with nuBuilder since 3 weeks and i'm still a newbie on this great framework.
I created a database with several tables with phpmyadmin and managed the first lessons in nuBuilder successful.
Now Ihave following problem:
There's a table (tbl_tans) of Transaction-Numbers with these columns : tbl_tans_id, tans, date_created, date_used.
Now I search for a possibility to create a number of tans by using an Extra Action Button.
I tried to use the editform with the function nuSaveThis() - no success.
Then I tried to use the PHP-function nuRunQuery() with the sql-command "INSERT", but after lessons of trial&error and research, i found out, that nuRunQuery cannot be used with an INSERT-command.
Is there any other possibility? :?:

Thanks
(please excuse my horrible ennglish... :oops: )
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Adding Data directly to Database

Unread post by admin »

nuMax,

You said..
Now I search for a possibility to create a number of tans by using an Extra Action Button.
Do you mean you want to add new records to this table?

If so you don't need any "Extra Action Buttons" just 2 "Action Buttons"

Add - Which will appear on the Browse Form - for adding brand new records.
and
Clone - Which will appear on the Edit Form - for cloning a record that is similar.
Capture.PNG

Steven
You do not have the required permissions to view the files attached to this post.
nuMax
Posts: 2
Joined: Thu Jun 14, 2012 12:31 pm

Re: Adding Data directly to Database

Unread post by nuMax »

Hello Steven,

sorry, I wasn't exact enough.
I want to create more numbers by only one Click.
For example: All transactionnumbers in the table 'tbl_tans' are used and i need some new. So I have to use the add-button and the clone-button several times in a row. That's not very practical.
I'm searching for a possibility to create more than one number at once and therefore I think I need to write directly into a table by using a for-loop.
Perhaps you have any idea.

Thanks
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Adding Data directly to Database

Unread post by admin »

nuMax,

Is it always when you Add a record or does it sometime happen for a recored that is already there?

Is it always the same number of records to be added automatically?

Are there any fields (apart from the primary key) that will be different from the initial record?

BTW nuRunQuery can use the INSERT statement.

Steven
Post Reply