dimanche 22 mars 2015

Using a function within MySQL update


I've got a code snippet:



#!/bin/bash

timestamp()
{
date +%s
}
.
.//some code here
.
data_base="UPDATE ... SET last_update_time = 'timestamp' WHERE equip.title = '$equip_title';"
.
.//some [more] code here
.


To update the 'last_update_time' I call the timestamp function at the top of my shell script however the end result is that the 'last_update_time' gets updated with the 0 value. Also I've tried using back ticks on either side of date +%s :



timestamp()
{
date +%s #using back ticks
}


The end result was the same.


Q: How can I update the last_update_time with a time stamp?



Aucun commentaire:

Enregistrer un commentaire