Page 1 of 1

Adding Data directly to Database

Posted: Sun Jun 17, 2012 7:31 pm
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: )

Re: Adding Data directly to Database

Posted: Mon Jun 18, 2012 1:10 am
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

Re: Adding Data directly to Database

Posted: Mon Jun 18, 2012 1:50 pm
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

Re: Adding Data directly to Database

Posted: Tue Jun 19, 2012 12:40 am
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