No announcement yet.

How to: Create Number hit dowload

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to: Create Number hit dowload

    I will create Number hit download


    Filename File download Hit

    Filename_1 Name_1.pdf 132
    Filename_2 Name_2.doc 20

  • #2
    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];

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


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


    • #3
      Re: How to: Create Number hit dowload

      Thank you very much.


      • #4
        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.

        Run the Method name hit_counter Onvalidate Event.
        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.


        ** I'm not good at programming PHP.

        Thank you.


        • #5
          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 ....


          • #6
            Re: How to: Create Number hit dowload

            I am a failure.

            I tried to do as you suggest is not successful.

            Create Project sample
            I was able to Import it.

            Send to

            Thank you very much


            • #7
              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 zuck 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 ....