Problem with my MySQL command!

  • Hi


    I need help with my MySQL command.
    I want to create a page. I want that when I move the mouse over a photo, a small image appears somewhere in the same image, but in small format. I have pictures and small format. So, I created the page. I do it all with a CMS. I would like to add as many pictures to at least 2000! So, I do not always want to do because it takes a long time. So I created a table. With 2 structures, the first symbol is called the symbol and the second symbol is called smallicon. I always want to upload it to my website using the image uploader. But always, when I upload 2 images (small format and large format), only large format image appears. I hope you understand it a lot: I can not explain more clearly.
    Here is my SQL code:


    $ dir = "icons"; // it will be stored here
    $ i = 1;
    $ newname = $ _FILES ['icon'] ['name'];
    while (is_file ("$ dir / $ newname")) {
    $ ext = strrchr ($ _ FILES ['symbol'] ['name'], '.');
    $ newname = substr ($ _FILES ['icon'] ['name'], 0, - (strlen ($ ext) +1)). "$ _ $ I ext";
    $ I ++;
    }
    $ upload = move_uploaded_file ($ _ FILES ['icon'] ['tmp_name'], "$ dir / $ newname");
    chmod ("$ dir / $ newname", 0777);
    // (NOW WHICH IS A PART, AND WHAT IS,


    $ newnamess = $ _FILES ['ssicon'] ['name'];
    while (is_file ("icons_small / $ newnamess")) {
    $ extss = strrchr ($ _ FILES ['ssicon'] ['name'], '.');
    $ newnames = substr ($ _ FILES ['ssicon'] ['name'], 0, - (strlen ($ extss))). "_ $ Iss $ extss.";
    $ Iss ++;
    }
    $ upload = move_uploaded_file ($ _ FILES ['ssicon'] ['tmp_name'], "furnis_small / $ newnamess");
    chmod ("furnis_small / $ newnamess", 0777);


    // enter the table
    $ time = time ();
    $ query = mysql_query ("INSERT INTO" prefix $. "image (symbol, ssicon) VALUES
    ('

  • Debug correctly


    • One notices that a script does not do what it should.
    • Write the line at the beginning of the script: error_reporting (-1);
    • Use ini_set ('display_errors', true); so that the errors are also displayed.
    • One tries to limit the place which can be at fault. If this does not work, the entire script will initially be considered bad.
    • At prominent points in the script, you can output important variable contents and, if necessary, also issue a short output in conditional statements in order to check which condition has been executed. Important for MySQL errors (... not valid MySQL result resource ...): Use mysqli_error () or output query and test eg with phpmyadmin.
    • is repeated until inconsistencies in the script become apparent
    • This has found the problem (inconsistency) and can try to fix it. This is then the PHP documentation and other sources as a guide.
    • If the concrete problem still can not be solved, one can ask in forums for advice.
    • The program is running and you can remove the debug output again.

    The mysql_ * functions are deprecated and should not be used anymore. Use the mysqli_ * functions