CodeCharge Studio
search Register Login  

Visual PHP Web Development

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Building records in a linking table...custom insert

Print topic Send  topic

Author Message
jdhick

Posts: 4
Posted: 09/23/2004, 4:42 PM

Hi,

I have 2 tables (users , tasks) that have a many to many relationship, and are related via a linking table (the primary key of each, form a composite key in the linking table). So that, each user will have a "set" of records in the linking table.

My problem is, I would like to make it, so when a user is registered, it is convenient to create the various records needed in the linking table (both keys get inserted to "create" that users set of records).

I have been trying to do this through an editable grid, after retrieving the last_insert_id and saving it in the $_SESSION array. Then doing a LEFT JOIN as the data source, so that all the tasks are included.

The grid builds fine, but "inserting" into the linking table seems to be a problem. I've tried several ways of doing a custom insert, but I either lose the "submit" button, the grid reverts back to showing only 1 row, or sometimes not even showing the session variable.

I prefer to use the grid method, so that, if new tasks are added to the task table, they would automatically show up in the grid that the users see.

Is what I'm trying to do possible? Any suggestions would be appreciated.

Thanks for your help.

jdhick

_________________
Using Win2K, MySQL, Apache, PHP
View profile  Send private message
Sudheer
Posted: 09/24/2004, 5:00 AM

Hi jdhick,

Can you elaborate your problem, a bit more.
I guess, you are using editable grid to add/edit/delete tasks.
If that is the case, what is the necessity of using LEFT JOIN to show up user's tasks?

-Sudheer
Karsten


Posts: 57
Posted: 09/24/2004, 6:46 AM

hi jdhick,

sorry Sudheer im dropping in, but:

in this case jdhick you need 2 insertoperations
1. tasks
2. n:m relation table

its a masterproblem of CCS, CCS cant handle inserting/update a
recordsource wich contains more than 1 table
this means, you have to do the updates/inserts yourself.
unfortunally CCS supports ony ONE custom Insert operation
by its buildin custom insert builder.

so you have to write some SQL by hand for this.

if you want i help you really to fix this.

Read my post here http://forums.codecharge.com/posts.php?post_id=51109
_________________
If one gives up, he told himself he failed.
View profile  Send private message
jdhick

Posts: 4
Posted: 09/24/2004, 4:50 PM

Sudheer and Karsten, thanks for your responses.

I guess, I didn't explain it as well as I should have (I was getting very tired at that point).

The "linking table" that I referred to is task_progress, and holds the details of each task for each user (so that each user will have a seperate record for each task).

It is this task_progress table that has the LEFT JOIN with the task table. The reason for this, is so that all the tasks from the task table are presented in the grid regardless of whether the corresponding records exist yet in the task_progress table. The INSERT/UPDATE operations would then be acting on the task_progress table, adding new records that aren't there or updating the ones that are.

I hope this clarifies what I'm trying to do.

Thanks again for your willingness to help.

jdhick
_________________
Using Win2K, MySQL, Apache, PHP
View profile  Send private message

Add new topic Subscribe to topic   


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

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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