This topic is locked

insert to another table selected records

7/13/2009 2:37:01 AM
PHPRunner General questions
R
roadyx author

Hi Folks,
I've added a checkbox just before the {BEGIN add_link} section to make it the first button to appear. I am in need of assistance in adding 3 out of the 5 fields in the row of selected records to another table?
Thanks Much!

Roadyx

J
Jane 7/13/2009

Hi,
could you clarify how do you want to insert selected records?

Please give me more detailed description of what you want to achieve and I'll try to help you with sample code.

R
roadyx author 7/13/2009

Hi Folks,

I've added a checkbox just before the {BEGIN add_link} section to make it the first button to appear. I am in need of assistance in adding 3 out of the 5 fields in the row of selected records to another table?
Thanks Much!

Roadyx


HI Jane,
My problem is similar to the example in the manual advanced topics -> Sample Events -> "Send e-mail selected records".

  1. I'm doing this on the BEGIN {add_link} rather than BEGIN {del_link}. I created a button called PAY NOW.
  2. I have a table called payees - first_name, last_name, address, acct_num, tel_num
  3. I would like to have the user select the rows they would like to add in the shopping cart
  4. Upon selection and clicking the PAY NOW button, all selected records will be updated to a table called shop_cart.
  5. The fields that will go to the shop_cart table will be first_name, last_name, acct_num.
    Thanks In Advance,
    Roadyx

R
roadyx author 7/14/2009

Hi Jane,
I've figured it out. My only question is can I put it instead to the before processed page?
global $conn,$values;
if(@$_POST["a"]=="delete")
return true;
//do not delete if 'Email selected' button was clicked
if(@$_POST["a"]=="paynow")

{
//echo "<script>alert('test')</script>";
$strSQLInsert = "insert into transaction_tbl (userid, first_name, last_name, acct_num) values ('".$_SESSION["OwnerID"]."','".$deleted_values["payee_first_name"]."','".$values["payee_last_name"]."','".$values["account_number"]."')";

db_exec($strSQLInsert,$conn);
}

return fals

J
Jane 7/14/2009

Hi,
there is no $values arraing in the Before Process event.

You should select field values from database manually in this event.

R
roadyx author 7/14/2009

Hi,

there is no $values arraing in the Before Process event.

You should select field values from database manually in this event.


THANK YOU!