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

 Insert (Add) Record

Print topic Send  topic

Author Message
DataDoIt
Posted: 02/25/2004, 6:48 PM

CCS2; PHP4; MySQL

I want to add a new record to a table. The table is:

EmpID
EmpName

I'm coming into this AddRecord page via a link from another page, passing
the EmpID in the URL. When I get to the AddRecord page, I Retrieve Value
for Control for the EmpID field, and get the EmpID from the URL. The
problem is when I do this, I no longer have the ability to add a record.
Where have I gone wrong? The key is being able to use the EmpID as a passed
default value for the record to be inserted.

Thanks.

-Mike

DonB
Posted: 02/25/2004, 6:59 PM

Pass the value with a different name. The Data Source is using EmpID as the
primary key so when it is provided, the form is in Update mode. Without the
EmpID it is in Insert mode.

set your link to "AddRecord.asp?EmpID=123" when you call it to update
set your link to "AddRecord.asp?AddEmp=124" when you call it to insert.

The form will be in the Insert mode (because you did not supply EmpID), and
now you can retrieve the param AddEmp instead of EmpID like you were doing
before and do whatever you were doing with it.

I don't see why you have this predicament though. You evidently have a
1-to-many relationship for Employees to this other table you are inserting
into. SO... The primary key must be EmpID+some other column. Maybe you
really need to change the datasource on the AddResord page to have both of
these columns specified in the "where". Then, you can pass the EmpID but
not the second item and CCS will put you in Insert mode OR pass both values
and CCS will put you in Update mode.

--
DonB

http://www.gotodon.com/ccbth


"DataDoIt" <mike@datadoit.com> wrote in message
news:c1jmpv$k1c$1@news.codecharge.com...
> CCS2; PHP4; MySQL
>
> I want to add a new record to a table. The table is:
>
> EmpID
> EmpName
>
> I'm coming into this AddRecord page via a link from another page, passing
> the EmpID in the URL. When I get to the AddRecord page, I Retrieve Value
> for Control for the EmpID field, and get the EmpID from the URL. The
> problem is when I do this, I no longer have the ability to add a record.
> Where have I gone wrong? The key is being able to use the EmpID as a
passed
> default value for the record to be inserted.
>
> Thanks.
>
> -Mike
>
>

DataDoIt
Posted: 02/25/2004, 7:20 PM

Thanks Don. The latter suggestion worked - Called grid looking for the two
parameters, but one non existent, thus leaving me in Insert mode.

Incidently, for whatever reason, the former suggestion of changing the link
parameter name didn't work for me. PHP.

-Mike

"DonB" <~ccbth~@gotodon.com> wrote in message
news:c1jne3$lta$1@news.codecharge.com...
> Pass the value with a different name. The Data Source is using EmpID as
the
> primary key so when it is provided, the form is in Update mode. Without
the
> EmpID it is in Insert mode.
>
> set your link to "AddRecord.asp?EmpID=123" when you call it to update
> set your link to "AddRecord.asp?AddEmp=124" when you call it to insert.
>
> The form will be in the Insert mode (because you did not supply EmpID),
and
> now you can retrieve the param AddEmp instead of EmpID like you were doing
> before and do whatever you were doing with it.
>
> I don't see why you have this predicament though. You evidently have a
> 1-to-many relationship for Employees to this other table you are inserting
> into. SO... The primary key must be EmpID+some other column. Maybe you
> really need to change the datasource on the AddResord page to have both of
> these columns specified in the "where". Then, you can pass the EmpID but
> not the second item and CCS will put you in Insert mode OR pass both
values
> and CCS will put you in Update mode.
>
> --
> DonB
>
> http://www.gotodon.com/ccbth
>
>
> "DataDoIt" <mike@datadoit.com> wrote in message
>news:c1jmpv$k1c$1@news.codecharge.com...
> > CCS2; PHP4; MySQL
> >
> > I want to add a new record to a table. The table is:
> >
> > EmpID
> > EmpName
> >
> > I'm coming into this AddRecord page via a link from another page,
passing
> > the EmpID in the URL. When I get to the AddRecord page, I Retrieve
Value
> > for Control for the EmpID field, and get the EmpID from the URL. The
> > problem is when I do this, I no longer have the ability to add a record.
> > Where have I gone wrong? The key is being able to use the EmpID as a
> passed
> > default value for the record to be inserted.
> >
> > Thanks.
> >
> > -Mike
> >
> >
>
>


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.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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