How to: Create Number hit dowload

I will create Number hit download

Sample:

Filename File download Hit

Filename_1 Name_1.pdf 132
Filename_2 Name_2.doc 20

Re: How to: Create Number hit dowload

Make a Table

CREATE TABLE IF NOT EXISTS t_download_files
(
filename VARCHAR(255) NOT NULL,
dl_counter BIGINT NOT NULL,
CONSTRAINT PK_t_download_files PRIMARY KEY (filename)
);

Create a PHP Method:

FUNCTION increment_counter($filename)
{
$result = 0;
$sql =“select dl_counter from t_download_files where filename = $filename”;
sc_lookup(ds, $sql);
$dataset = $ds;
if (FALSE === $dataset) {sc_error_message({lang_dbms_err_common});}
elseif (empty($dataset)) {sc_error_message({lang_dbms_err_recordset_empty});}
else {
$result = = $dataset[0][0];
}
$result++;

$sql = " Update t_download_file
set dl_counter = $result";

sc_exec_sql($sql);
}

call this method after the download… In a PHP-Button in Your Form
in onvalidation event ect…

Re: How to: Create Number hit dowload

Thank you very much.

Re: How to: Create Number hit dowload

I have a problem.

I created a Method name Hit_counter.
Commands as an example that you Post.

Final
Run the Method name hit_counter Onvalidate Event.

Error;
Parse error: syntax error, unexpected.

I am doing is correct. How to fix.

Do you have examples of this Project or not.
Please send it to. Jumpuko@gmail.com.


** I’m not good at programming PHP.

Thank you.

Re: How to: Create Number hit dowload

Sorry, I have programmed only as fast … without testing it.
$ result = $ dataset [0] [0]; is wrong

$ result = $ dataset [0] [0];

daruaf parse error indicates that the interpreter does not understand the code

My approach:

The error message is the full filename of the script. Copy it.
Open an editor (zb.Textpad) and download the file
Jump to the row which is in the error message and examine them …

Re: How to: Create Number hit dowload

I am a failure.

I tried to do as you suggest is not successful.

Please.
Create Project sample
I was able to Import it.

Send to Jumpuko@gmail.com.

Thank you very much

Re: How to: Create Number hit dowload

I’m sorry, but I do not have time for it. Maybe I’ll get to that in a couple of ATAG. Because if you’re not as fit in PHP do you have so ewas what works.
Find out yourself is better:

Solution scheme:

  1. everything happens AFTER the file has been downloaded successfully
  2. Read the number of previous downloads from the file table
    select from dl_counter t_download_files where filename = $ filename
  3. increase the number by 1
    4 the value zu?ck write to the database
    $ sql = "Update t_download_file
    $ result = set dl_counter
    where filename = $ filename "

Or code your post here and we’ll see …