Forums

DB Read Just the primary key "id"

msreyes 27 Feb, 2017
I need a bit of help. I am doing this because two people are going to manage this.
First thing is when a user clicks "submit" on the form I am doing a DB SAVE... that works just fine.

As part of the "Submit" process I am doing the paypal redirect for payment.

I am trying to do a DB READ from the record I just saved to pass that as part of my paypal item info... the reason for this is someone is getting the forms on submit, someone else is processing the payment. If I have them pass this primary key info back and forth (e.g. EVENT SUBMISSION - W15" <-the number 15 being the primary key).

So how do I:
[list]Read the latest record which was just entered into the database?[/list]
[list]Parse this ID into a variable, not array?[/list]
GreyHead 27 Feb, 2017
HI msreyes,

After the DB Save the new record ID and the saved data are added to the $form->data array - add a Debugger action temporarily to see exactly what is there.

Bob
msreyes 27 Feb, 2017
So I do not need to do a DB READ after a DB SAVE?
GreyHead 27 Feb, 2017
HI msreyes,

No

Bob
msreyes 28 Feb, 2017
Ok, I am struggling😟

Here is my database "Save"



After I do this I send an email, then do the paypal redirect. In the "Item name field" I am looking to also pass the "id" from my database save.
msreyes 03 Mar, 2017
In my array I have (debug):

Array
(

[Data] => Array
(
[id] => 42
)

)

As silly as this sounds, how to I get just the number 42 into a variable I can use elsewhere?
GreyHead 03 Mar, 2017
Answer
Hi msreyes,

it should already be in $form->data['Data']['id']

Bob
msreyes 03 Mar, 2017
Awesome! Thanks.
This topic is locked and no more replies can be posted.