keep count of times of clicks/downloads from/in grid

Hello, i have a grid application with a field upload(filename), also another field that shows small image to download the file {download_file}

I want to keep count of number of downloads of each file in the grid that shows the files…

  • I added a new field to mysql database table name: dl_times
  • tried to make an ajax event that onClick of the field updates the table something like
 on Ajax event onClick of field:
sc_lookup(current_times, "SELECT dl_times FROM myTable where file_id={file_id}");
sc_exec_sql("UPDATE myTable SET dl_times={current_times[0][0]} WHERE file_id={fileid}", "myConnection");

also tried the code sample that updates the database with certain fields set

nothing work,

anybody can explain why or how to do this download_times trick?

thanks in advance

nobody needed this? only me grrrrrrrrr

Maybe your SQL Need Add + 1.
sc_exec_sql(“UPDATE myTable SET dl_times= dl_times +1 WHERE file_id={fileid}”, “myConnection”);

thanks for your input, actually it doesn’t send anything to database, where I assume is not ok… changing the variable later is easy, but doesnt work
any idea or if you guys done similar function please explain
thanks

well, it desn’t send anything to database, no update is being done, that can be changed later…
thanks a lost for your input though
if anybody has done such function or has an idea to do this appreciate your thoughts…
thanks

Hi I can’t really help but there is a possible typo in
file_id={fileid}