CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 UPDATE function with two WHERE critera

Print topic Send  topic

Author Message
sam
Posted: 06/16/2005, 10:34 AM

Hi,

Here is my situation. I have 3 tables, "worker", "jobs" and "worker_jobs_map". As you would expect, the worker_jobs_map table contains fields for "worker_id" and "job_id" to map workers to jobs. However, that table also contains job details for that worker. So, it looks like this:

** worker_jobs_map **
+ worker_id +
+ job_id +
+ start_date +
+ end_date +
+ supervisor_name +
+ +
++++++++++++++

Here is the problem, there is a page with a record form where the user can update the job details (start_date, end_date, supervisor_name) for a given worker. The problem is, the UPDATE query updates that information for all the entries where worker_id=X. I need it to update only the rows where worker_id=X AND job_id=Y.

How can I do this?
sam
Posted: 06/16/2005, 11:17 AM

OK, let me get a little more specific. This is what I want the SQL query to look like. My problem is that I'm not sure how to integrate it with the CCS functions (the PHP syntax).

UPDATE worker_jobs_map
SET start_date=$start_date, end_date=$end_date, supervisor_name=$supervisor_name
WHERE worker_id=$worker_id AND job_id=$job_id

I just noticed how to do the Custom Update, but I'm not sure how to identify these variables with the CCS syntax. Can anyone help?

THanks,

Sam
Nicole

Posts: 586
Posted: 06/17/2005, 5:50 AM

Sam,
You really need to set up Custom Update. I think that you can use Custom Update of Table type. CCS obtains fields to update automatically when you configuring Custom Update settings, but you need to add/remove fields from UPDATE part. Then add second field to WHERE verify parameters settings. For a records form they are like
Field
Name: job_id
Type: Integer
Condition: equals(=)
Parameter Source
Name: job_id
Type: URL
And the same for worker_id.

_________________
Regards,
Nicole
View profile  Send private message
sam
Posted: 06/20/2005, 7:39 PM

Thank you Nicole. I found the Custom Update and followed your steps. Everything sounds logical to me. However, once I upload the page and try to update a record, I now get this error:

One or more parameters missing to perform the Update/Delete. The application is misconfigured.

It's pretty vague -- any idea where to start? I have tried altering the update query a few times with no luck -- I keep getting this error.

Thanks for your help.

Sam

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.

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.