Forums

Change value in Table from Connection

Fang 13 May, 2010
Hi, sorry to make a new topic but I couldn't find what I was looking for.

I have a website set up to take forms from users

There is a hidden row at the bottom called 'Confirmed' which has a default value of 0


The database which is viewed using 2 separate views (connections)

One view is available to the public and is filtered using
SQL
WHERE Confirmed = 1

The other view is only available to Administrators and is filtered using
SQL
WHERE Confirmed = 0


I need to make a button on the Admin view that changes the state of 'Confirmed' in the database from '0' to '1'



Any help would be greatly appreciated

Thanks
Luke
Fang 14 May, 2010
Could it be done with a update statement like the one below in the Connection View Settings Body section?


<INPUT TYPE="button" NAME="Confirm" VALUE="Confirm" onClick="DOUPDATE()"> 

function DOUPDATE()
{
SQL=UPDATE `JOS_CHRONOFORMS_SURVEY` SET `Confirm`='1'
WHERE `CF_ID`=     (THIS CF_ID; no idea how to write that)
}
GreyHead 14 May, 2010
Hi Fang,

That's a messy mixture of PHP, JavaScript and MySQL that probably won't do anything.

You could add an Ajax script to a button in the body section. That woudl link back to a little PHP snippet in one off the ExtraCode boxes that would update the database.

Not too hard to do but needs some coding skills.

Bob
Fang 17 May, 2010
Thanks Bob,
It works now🙂
This topic is locked and no more replies can be posted.