Jump to content

ChenXiu

Members
  • Posts

    177
  • Joined

  • Last visited

Community Answers

  1. ChenXiu's post in php echo variables that haven't happened yet. was marked as the answer   
    Nevermind. I figured it out.
    "sprintf()"
  2. ChenXiu's post in Base64 vs Readfile: Display Secured Image was marked as the answer   
    Good point. Thank you.
    Using Data Base 64, the statistics are fairly humble:
    image size: 16K
    gzipped page size (using "page info" in browser): 19K
    actual page size: 35K
    For me, using readfile() seems to be the way to go.
    Using this header in readfile, the image can have a tidy filename should a visitor want to right-click/save the image:
    header('Content-Disposition: attachment; filename="Whatever_I_Want"');
    Further, should the actual image be missing, readfile can display an image of an error message:
    $imgData = getimagesize($complete_filename_and_path);
    if( !$imageData ) { $file_name = "image-of-an-error.png"; }
    Thank you again.
    p.s. (even though I solved it before you did 😃 )
  3. ChenXiu's post in CONCAT with WHERE clause? was marked as the answer   
    Thank you Barand. Appreciation offered.
    Fortunately (and unfortunately) I realized that there is no answer to my original question (it can't be done).
    QUESTION: Can a "where clause" be added to an "insert.....on duplicate key update" query without additional queries?
    ANSWER: NO.
    REASON: Because for the "...on duplicate key update" portion to know whether some string exists in some column, there must, by definition, be an additional query.
    Although I appreciate Your's and Req's answers because they offer alternative "mysql-based" solutions, I don't like them.
    Req's answer of creating additional tables and then having to tie them creates all kinds complexity I don't need in my life.
    And your answer would result in an abominably large, and endlessly growing, table.
    My solution ended up being that $_SESSION["flavor"] captures vistor's $_POST["flavor"], with the following simple line of code:
    if ( strpos( $_POST["flavor"] , $_SESSION["flavor"] ) == FALSE ) { mysqli_query( $conn , $barands_concat_query ); }

     
×
×
  • 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.