CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 how to transfer values between tbl's (custom actio

Print topic Send  topic

Author Message
Tomasz
Posted: 01/16/2002, 1:43 PM

as i can see, i can change default action assigned to button in generated code at 'custom action' event

i would like to make some SQL work after clicking this button: moving record from one table to another.

i have 2 tables: 'users_temp' and 'users' (identical). user after self-registration is kept in 'users_temp' table, admin have to authorize him/her. Authorization have to be done via deleting record from 'users_temp' and inserting all values in 'users'.

it can be done using SQL, something like:
INSERT INTO users SELECT * FROM users_temp
(user_id variable have to be added to sql above, pls help)

and then delete this record from "users_temp"
can anybody help me wih customization of custom action event?

2 nd question:
how about autoincrement field from 'users_temp' after transferring values? overrides field in 'users' or not?
fadsfsad
Posted: 01/17/2002, 12:41 AM

dfads
Ken Hardwick
Posted: 01/17/2002, 12:53 AM

...using ASP...

Assuming the two tables have same fields with same names...here is what I would set this up...
The "admin" would login and goto a "secured" grid page listing all the current records in the "User_temp" table. The admin person would select a record listed to "edit"...and once in "edit" (User_Temp_record page) for that specific record...the "admin" would click on "delete" button..which would delete the specific record from the temp table and insert new record to user table.

So, to do this, in the User_Temp_record page/form, I would add code similar to below in the "before delete" event.
Note, I would bring in all the fields from the User_temp table into the form.


newSQL = "insert into Users (" & _
"user_name," & _
"user_ID," & _
"emp_password," & _
"user_level," & _
"user_Primary_id," & _
"user_email)" & _
" values (" & _
ToSQL(flduser_name, "Text") & "," & _
ToSQL(fldUser_ID, "Text") & "," & _
ToSQL(fldUser_password, "Text") & "," & _
ToSQL(fldUser_level, "Number") & "," & _
ToSQL(flddUser_Primary_id, "Number") & "," & _
ToSQL(fldUser_email, "Text") & _
")"

cn.execute(newSQL)

(This executes and then your delete is processed as normal)

Note, in this case the User_Primary_Id in the User table is just using the primary_id as assign by the temp table. You can skip this and just do a auto-number primary field in the user table.
As far as your autonumber field in your user_temp table, even though you delete a record, that autonumber that was used will not be used again so it should be unique for next record transferred to user table.

Hope this makes sense and helps...if not, post additional question...

Ken Hardwick
Tomasz
Posted: 01/22/2002, 1:08 PM

Ken,

method is clear, but this sql statement...
is that means that I cannot use SELECT * ?
(I use PHP).

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.