11-11-2011, 11:33 | #1 |
The Last Airbender
Join Date: Jun 2006
Location: Pigmopad
Posts: 11,915
|
Cron job to change database entry?
Hi clever programmer types
I'm setting up some software at work to make our workflow a little smoother, quicker and more automated. I'm using vtiger open source software to do this. I've currently got a workflow setup so that when an "Email Supplier" tickbox is true, that supplier is emailed the quote. Trouble is, the supplier gets emailed every time the quote is modified and saved. This workflow is run with a cron jon. What I'd like to do is have the "Email Supplier" tickbox set to false each time the cron job is run. I've found the entry in the sql database but not sure what to do next.
__________________
|
11-11-2011, 11:41 | #2 |
Chef extraordinaire
Join Date: Jul 2006
Location: Infinite Loop
Posts: 11,143
|
I would write a php script to loop through the database and set the field to false
__________________
"Dr Sheldon Cooper FTW!" |
11-11-2011, 12:10 | #3 |
The Last Airbender
Join Date: Jun 2006
Location: Pigmopad
Posts: 11,915
|
Great....so how would I do that?
__________________
|
11-11-2011, 12:14 | #4 |
Chef extraordinaire
Join Date: Jul 2006
Location: Infinite Loop
Posts: 11,143
|
to MSN!
__________________
"Dr Sheldon Cooper FTW!" |
12-11-2011, 00:52 | #5 |
Screaming Orgasm
Join Date: Jul 2006
Location: Newbury
Posts: 15,194
|
Kapow?
No need for a loop for this by the way - a single update would do it, which you can do just about any way you want. |
12-11-2011, 21:04 | #6 |
Preparing more tumbleweed
Join Date: Jun 2006
Location: Hawaii
Posts: 6,038
|
As Mark suggests, should be as simple as running something like:
UPDATE table SET field = FALSE WHERE somecondition=something; If you're just trying to do the entire table you can ignore everything from WHERE (but don't forget the ';' mark)
__________________
Mal: Define "interesting"? Wash: "Oh, God, oh, God, we're all gonna die"? |
13-11-2011, 13:11 | #7 |
Chef extraordinaire
Join Date: Jul 2006
Location: Infinite Loop
Posts: 11,143
|
I think we've almost cracked it I suggested a loop because I didn't know his db structure
__________________
"Dr Sheldon Cooper FTW!" |
13-11-2011, 16:23 | #8 |
Dubious
Join Date: Sep 2008
Location: Northampton
Posts: 1,571
|
__________________
Look at your signature, now back to mine, now back to yours, now back to mine.
Sadly, yours isn't mine. But if you stopped writing about other things and made this your signature, yours could be like mine. Look down, back up. Where are you? You're on Boat Drinks, reading the signature your signature could be like. I'm on a computer. |
19-11-2011, 12:26 | #9 |
The Last Airbender
Join Date: Jun 2006
Location: Pigmopad
Posts: 11,915
|
Just thought I'd post up that with loads of help from Leo, I got all of this working spot on
The database changes work and it's also tied in to the current corn job so runs when it should.
__________________
|