John K. Blood
|
Posted: 05/05/2002, 5:29 PM |
|
Hi all!
I'm trying to update a database table so that one field is set to zero
whenever a user inserts a new record or updates an existing record. I have
tried several combinations of code and event, and I'm really stuck. I need
to show this working to a client tomorrow morning. I just cannot get it to
work and am just learning SQL/PHP. I've had some real victories during this
project. This is the last bit of code I have to write. It should be simple.
I'm sure it is simple. I'm missing it and losing it.
Any help will be incredibly appreciated. I've tried my Professional support
from CC, and no luck. I haven't heard back from anyone since I posted my
request yesterday afternoon.
Here's what I've worked out, but it's not working. I know I am so close, but
I can't get it working. This is unbelievably frustrating. Can anyone lend
some advice?
For a 'Contacts' record:
After Update:
$sSQL = "update Contacts set " . "ContactApproved=" . tosql("0", "Number");
$sSQL .= " where " . $sWhere;
After Insert:
$mSQL = "insert into Contacts (ContactApproved) values ("0");
For a Member Roster record:
After Update:
$sSQL = "update LINRoster set " . "Approved=" . tosql("0", "Number");
$sSQL .= " where " . $sWhere;
Again, any assistance will be greatly appreciated. Help??!
THANKS!
John
jblood@beholdlearning.com
|
|
|
Webmaster
|
Posted: 05/05/2002, 8:26 PM |
|
Here's a couple of solutions. Since you're using mysql. Use phpmyadmin to
modify the field. Just click on the Change under the action column. Then put
the value you want under Default. This will make your insert work. Put the
fields on the form and set them to hidden. Then in Before insert and Before
Update event put following code:
$fldContactApproved = 0;
then do the same thing for the Member Roster Record
$fldApproved = 0;
Let me know if this works for you.
"John K. Blood" <jblood@beholdlearning.com> wrote in message
news:ab4iq2$mm6$1@news.codecharge.com...
> Hi all!
>
> I'm trying to update a database table so that one field is set to zero
> whenever a user inserts a new record or updates an existing record. I have
> tried several combinations of code and event, and I'm really stuck. I need
> to show this working to a client tomorrow morning. I just cannot get it to
> work and am just learning SQL/PHP. I've had some real victories during
this
> project. This is the last bit of code I have to write. It should be
simple.
> I'm sure it is simple. I'm missing it and losing it.
>
> Any help will be incredibly appreciated. I've tried my Professional
support
> from CC, and no luck. I haven't heard back from anyone since I posted my
> request yesterday afternoon.
>
> Here's what I've worked out, but it's not working. I know I am so close,
but
> I can't get it working. This is unbelievably frustrating. Can anyone lend
> some advice?
>
> For a 'Contacts' record:
> After Update:
> $sSQL = "update Contacts set " . "ContactApproved=" . tosql("0",
"Number");
> $sSQL .= " where " . $sWhere;
>
> After Insert:
> $mSQL = "insert into Contacts (ContactApproved) values ("0");
>
> For a Member Roster record:
> After Update:
> $sSQL = "update LINRoster set " . "Approved=" . tosql("0", "Number");
> $sSQL .= " where " . $sWhere;
>
> Again, any assistance will be greatly appreciated. Help??!
>
> THANKS!
>
> John
>jblood@beholdlearning.com
>
>
|
|
|
|