Jump to content

CroNiX

Staff Alumni
  • Posts

    1,469
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by CroNiX

  1. Put the url to the delete function there, not CALL the actual delete function. Just like you are for the first button on the same line where you give the url to the function, editaAtividade.php?id=

  2. Well, yes. sprintf() is converting the %[identifiers], which mysql is also using. So don't use sprintf() when using those mysql functions that contain %[identifier]. If you use prepared statements for your queries, this will be a non-issue plus they are way better to use anyway.

  3. Why not? You say "should look at the previous entry" I would expect that looking at the times would be the best way to do that.

     

    If you're not using an auto_increment column already then you can add one as part of a composite key like (account_id, entry): the will count from 1 per account_id, so you'll know for a fact that the previous entry was (account_id, current entry-1).

    I can see that working using the auto_increment ID only if they don't allow deleting entries, otherwise I wouldn't count on (entry - 1) being the correct ID.

    • Like 1
  4. If the email needs to be sent each and every time the submit button is clicked to create the initial query, then just have that code also send the email so there is only one step. If it's optional to send the email, then a 2nd step would be necessary similar to what you described.

  5. All the output buffering does is send the output once everything has been processed instead of "real time"...or "linearly, as processed". They really should take about the same time for the end user to receive both. The same calculations, as you put it, would take place in both scenarios. The only difference using buffered output is the users browser receives the entire document at once instead of like sending the header, waiting for something to be processed and then sending that out. So instead of the page being "drawn" in chunks, it's all done at once.

  6.  

    Your code worked I had also just found is_dir and it seemed to do the job as well sould i use file_exists over is_dir ?

    define('UPLOAD_DIR', 'images/' .$today. '/');
    if (!is_dir(UPLOAD_DIR)) {
        mkdir(UPLOAD_DIR);
    }
    

    You can use either. file_exists() works on both files and dirs and I usually use it for both cases.  But yeah, is_dir() would obviously work for this.

     

    To get the filename/path without extension, why don't you just grab it before you add the extension?

    $raw_file = UPLOAD_DIR . uniqid();
    $file = $raw_file . '.png';
    ...
    print $success ? $raw_file : 'Unable to save the file.';
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.