Appreciate any help in advance!
I have a DB with two tables, var table and val table.
varid image vartype
valid sig winner varid
The tables have a 1 to many relationship, meaning there are many val's per var.
Now with that established, I have a form that asks for the input to populate that database.
The user can add multiple vals in one go - basically I have the form setup using ajax so when the user completes the fields, it posts to my vale table and then refreshes the content (not the page) using ajax/jquery so the user can enter another val/record.
Once the user has entered all of their vals, the user should add the var record. When that var posts to the var table, an varid is automatically assigned and should be associated with the last X number of vals the user entered.
For example
varid | image | vartype
1 | test.jpg | button
valid | sig | winner | varid
1 | true | true | 1
2 | false | true | 1
3 | true | true | 1
Anyway, I need help understanding the procedure or theory behind this... In my mind, it goes something like this.
does this sound right or am I totally in space somewhere?
any assistance would be greatly appreciated.
You could create a $_SESSION var and fill it with an array of all the 'valid' using MySQLS mysql_insert_id() function.
Then when making the 'var' table insert you can simply update the 'val' table rows that match the 'valid''s stored in the $_SESSION var.
Don't forget to clear the $_SESSION var once that's finished.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.