Salta al contenuto
  • CATEGORIES
  • La Community Connect.gt
  • Presentati alla Community
  • News Ufficiali da Connect.gt
  • Internet News
  • A Scuola Di
  • Digital Marketing
  • Intelligenza Artificiale
  • SEO & GEO
  • Web Marketing e Content
  • Google Analytics e Web Analytics
  • Google Ads & Advertising
  • YouTube
  • TikTok, Instagram e altri Social
  • Google Adsense, Affiliazioni e Guadagno
  • E-Commerce
  • Coding e Sistemistica
  • Help Center: consigli per il tuo progetto
  • Hosting e Cloud
  • Coding
  • CMS & Piattaforme Self-Hosted
  • Annunci e Collaborazioni
  • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
  • Collaborazioni WEB e Lavoro: offro e cerco
  • Impresa, Fisco e Leggi
  • Consulenza Legale e Professioni Web
  • Consulenza Fiscale, Imprese, Startup e P.Iva
  • Gli Off Topic
  • PC, Smartphone e altri Hardware
  • Tutti i Software
  • GT Fetish Cafè
  • Discussioni
  • 0 Non letti 0
  • Recenti
  • Hashtag
  • Popolare
  • Utenti
  • Privacy
  • Termini e condizioni
  • © 2026 Search On Media Group S.r.l.
Collassa
Connect.gt
Il network Search On
Connect.gt WMF AI Festival Accademia Advanced SEO Tool AgentCy Social Media Strategies Search Tech
Registrati Accedi
Connect.gt
Stream Interest Categorie Hashtag
  1. La community italiana di SEO, marketing digitale e AI
  2. Categorie
  3. Coding e Sistemistica
  4. Coding
  5. [PHP]problema visualizzazione immagini

[PHP]problema visualizzazione immagini

Pianificato Fissato Bloccato Spostato Coding
13 Post 2 Autori 653 Visualizzazioni 1 Seguito
  • Da Vecchi a Nuovi
  • Da Nuovi a Vecchi
  • Più Voti
Rispondi
  • Risposta alla discussione
Effettua l'accesso per rispondere
Questa discussione è stata eliminata. Solo gli utenti con diritti di gestione possono vederla.
  • J
    J
    jeeves
    scritto su ultima modifica di
    User Attivo 0
    #3

    Tu vuoi memorizzare la variabile $id_cartella nel database? Se sì, facci vedere la struttura della tabella del database dove vuoi che venga memorizzato $id_cartella 😉

    1 Risposta Ultima Risposta
    Miglior risposta 0
    0
    • G
      G
      giorgiodp
      scritto su ultima modifica di
      User Attivo 0
      #4

      la normalizzazione l'ho totalmente ignorata,lo so..

      -- phpMyAdmin SQL Dump
      -- version 2.6.1

      -- Host: localhost
      -- Generato il: 31 Mag, 2008 at 06:04 PM
      -- Versione MySQL: 4.1.9
      -- Versione PHP: 4.3.10

      -- Database: guest_book


      --
      -- Struttura della tabella messaggi

      CREATE TABLE messaggi (
      id_user int(10) NOT NULL auto_increment,
      id_cartella tinyint(1) default NULL,
      username varchar(65) NOT NULL default '',
      password varchar(65) NOT NULL default '',
      user varchar(20) NOT NULL default '',
      gender varchar(10) NOT NULL default '',
      date_of_birth date NOT NULL default '0000-00-00',
      country varchar(30) NOT NULL default '',
      test_arousal_photo1 tinyint(3) default NULL,
      test_valence_photo1 tinyint(3) default NULL,
      test_arousal_photo2 tinyint(3) default NULL,
      test_valence_photo2 tinyint(3) default NULL,
      test_arousal_photo3 tinyint(3) default NULL,
      test_valence_photo3 tinyint(3) default NULL,
      test_arousal_photo4 tinyint(3) default NULL,
      test_valence_photo4 tinyint(3) default NULL,
      test_arousal_photo5 tinyint(3) default NULL,
      test_valence_photo5 tinyint(3) default NULL,
      test_arousal_photo6 tinyint(3) default NULL,
      test_valence_photo6 tinyint(3) default NULL,
      test_arousal_photo7 tinyint(3) default NULL,
      test_valence_photo7 tinyint(3) default NULL,
      test_arousal_photo8 tinyint(3) default NULL,
      test_valence_photo8 tinyint(3) default NULL,
      test_arousal_photo9 tinyint(3) default NULL,
      test_valence_photo9 tinyint(3) default NULL,
      test_arousal_photo10 tinyint(3) default NULL,
      test_valence_photo10 tinyint(3) default NULL,
      test_arousal_photo11 tinyint(3) default NULL,
      test_valence_photo11 tinyint(3) default NULL,
      test_arousal_photo12 tinyint(3) default NULL,
      test_valence_photo12 tinyint(3) default NULL,
      test_arousal_photo13 tinyint(3) default NULL,
      test_valence_photo13 tinyint(3) default NULL,
      test_arousal_photo14 tinyint(3) default NULL,
      test_valence_photo14 tinyint(3) default NULL,
      test_arousal_photo15 tinyint(3) default NULL,
      test_valence_photo15 tinyint(3) default NULL,
      test_arousal_photo16 tinyint(3) default NULL,
      test_valence_photo16 tinyint(3) default NULL,
      test_arousal_photo17 tinyint(3) default NULL,
      test_valence_photo17 tinyint(3) default NULL,
      test_arousal_photo18 tinyint(3) default NULL,
      test_valence_photo18 tinyint(3) default NULL,
      test_arousal_photo19 tinyint(3) default NULL,
      test_valence_photo19 tinyint(3) default NULL,
      test_arousal_photo20 tinyint(3) default NULL,
      test_valence_photo20 tinyint(3) default NULL,
      test_arousal_photo21 tinyint(3) default NULL,
      test_valence_photo21 tinyint(3) default NULL,
      test_arousal_photo22 tinyint(3) default NULL,
      test_valence_photo22 tinyint(3) default NULL,
      test_arousal_photo23 tinyint(3) default NULL,
      test_valence_photo23 tinyint(3) default NULL,
      test_arousal_photo24 tinyint(3) default NULL,
      test_valence_photo24 tinyint(3) default NULL,
      test_arousal_photo25 tinyint(3) default NULL,
      test_valence_photo25 tinyint(3) default NULL,
      test_arousal_photo26 tinyint(3) default NULL,
      test_valence_photo26 tinyint(3) default NULL,
      test_arousal_photo27 tinyint(3) default NULL,
      test_valence_photo27 tinyint(3) default NULL,
      test_arousal_photo28 tinyint(3) default NULL,
      test_valence_photo28 tinyint(3) default NULL,
      test_arousal_photo29 tinyint(3) default NULL,
      test_valence_photo29 tinyint(3) default NULL,
      test_arousal_photo30 tinyint(3) default NULL,
      test_valence_photo30 tinyint(3) default NULL,
      test_arousal_photo31 tinyint(3) default NULL,
      test_valence_photo31 tinyint(3) default NULL,
      test_arousal_ foto32 tinyint(3) default NULL,
      test_valence_photo32 tinyint(3) default NULL,
      test_arousal_ foto33 tinyint(3) default NULL,
      test_valence_photo33 tinyint(3) default NULL,
      test_arousal_ foto34 tinyint(3) default NULL,
      test_valence_photo34 tinyint(3) default NULL,
      test_arousal_ foto35 tinyint(3) default NULL,
      test_valence_photo35 tinyint(3) default NULL,
      test_arousal_ foto36 tinyint(3) default NULL,
      test_valence_photo36 tinyint(3) default NULL,
      test_arousal_ foto37 tinyint(3) default NULL,
      test_valence_photo37 tinyint(3) default NULL,
      test_arousal_ foto38 tinyint(3) default NULL,
      test_valence_photo38 tinyint(3) default NULL,
      test_arousal_ foto39 tinyint(3) default NULL,
      test_valence_photo39 tinyint(3) default NULL,
      test_arousal_ foto40 tinyint(3) default NULL,
      test_valence_photo40 tinyint(3) default NULL,
      test_arousal_ foto41 tinyint(3) default NULL,
      test_valence_photo41 tinyint(3) default NULL,
      test_arousal_ foto42 tinyint(3) default NULL,
      test_valence_photo42 tinyint(3) default NULL,
      test_arousal_ foto43 tinyint(3) default NULL,
      test_valence_photo43 tinyint(3) default NULL,
      test_arousal_ foto44 tinyint(3) default NULL,
      test_valence_photo44 tinyint(3) default NULL,
      test_arousal_ foto45 tinyint(3) default NULL,
      test_valence_photo45 tinyint(3) default NULL,
      test_arousal_ foto46 tinyint(3) default NULL,
      test_valence_photo46 tinyint(3) default NULL,
      test_arousal_ foto47 tinyint(3) default NULL,
      test_valence_photo47 tinyint(3) default NULL,
      test_arousal_ foto48 tinyint(3) default NULL,
      test_valence_photo48 tinyint(3) default NULL,
      test_arousal_ foto49 tinyint(3) default NULL,
      test_valence_photo49 tinyint(3) default NULL,
      test_arousal_ foto50 tinyint(3) default NULL,
      test_valence_photo50 tinyint(3) default NULL,
      date datetime NOT NULL default '0000-00-00 00:00:00',
      PRIMARY KEY (id_user)
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PACK_KEYS=0 AUTO_INCREMENT=878 ;

      -- Dump dei dati per la tabella messaggi

      INSERT INTO messaggi VALUES (1, 0, 'g', 'b2f5ff47436671b6e533d8dc3614845d', '0', '0', '0000-00-00', 'selected', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2008-05-31 04:51:10');
      INSERT INTO messaggi VALUES (872, 0, 'u', '7b774effe4a349c6dd82ad4f4f21d34c', 'researcher', 'female', '1952-09-24', 'LA', 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, -2, 0, 0, 2, -2, 0, -1, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2008-05-31 05:05:25');

      1 Risposta Ultima Risposta
      Miglior risposta 0
      0
      • J
        J
        jeeves
        scritto su ultima modifica di
        User Attivo 0
        #5

        Ok ora fammi sapere che cosa vuoi inserire insieme a $id_cartella e dove inserire (in che campi) 😉

        1 Risposta Ultima Risposta
        Miglior risposta 0
        0
        • G
          G
          giorgiodp
          scritto su ultima modifica di
          User Attivo 0
          #6

          grazie:

          in questo passaggio
          <?php
          $connessione=mysql_connect("localhost", "
          $selezione_db=mysql_select_db("guest_book", $connessione);
          $query = mysql_query("SELECT id_user, date FROM messaggi ORDER BY date DESC limit 1");
          while($riga = mysql_fetch_assoc($query))
          {
          $id_user = $riga['id_user'];
          }
          $id_cartella = substr($id_user, -1, 1);
          $cartella = "fotos/".$id_cartella ;
          $image_src ="fotos/" . $id_cartella . "fotos/"."1" . ".jpg";
          echo "<img src="$image_src">";
          ?>

          vorrei inserire il valore

          $id_cartella = substr($id_user, -1, 1);
          $id_cartella = che sara' da 0 a 9
          inserirlo nel campoid_cartella del tabase

          1 Risposta Ultima Risposta
          Miglior risposta 0
          0
          • G
            G
            giorgiodp
            scritto su ultima modifica di
            User Attivo 0
            #7

            ho questa variabile:
            $id_cartella = substr($id_user, -1, 1);
            l'echo di $id_cartella = un numero,

            nel db ho creato un campo id_cartella

            che comando gli do in php per farla passare nel db?

            grazie

            1 Risposta Ultima Risposta
            Miglior risposta 0
            0
            • J
              J
              jeeves
              scritto su ultima modifica di
              User Attivo 0
              #8

              Sì questo l'ho capito, ma dato che la tabella messaggi c'hai quasi 100 campi, (test... ecc...) vuoi inserire una riga solo con $id_cartella o inserire nella stessa riga più cose?

              1 Risposta Ultima Risposta
              Miglior risposta 0
              0
              • G
                G
                giorgiodp
                scritto su ultima modifica di
                User Attivo 0
                #9

                ho già inserito una riga, la seconda, che si chiama id_cartelle

                1 Risposta Ultima Risposta
                Miglior risposta 0
                0
                • J
                  J
                  jeeves
                  scritto su ultima modifica di
                  User Attivo 0
                  #10

                  Sì, ma nella riga che inserisci che campi vai a riempire? Solo $id_cartella? 🙂

                  1 Risposta Ultima Risposta
                  Miglior risposta 0
                  0
                  • G
                    G
                    giorgiodp
                    scritto su ultima modifica di
                    User Attivo 0
                    #11

                    si un solo campo contenente il valore id_cartella

                    1 Risposta Ultima Risposta
                    Miglior risposta 0
                    0
                    • J
                      J
                      jeeves
                      scritto su ultima modifica di
                      User Attivo 0
                      #12

                      Allora eccoti il codice:

                      <?php
                      // Dati di connessione al database
                      $dbhost = "localhost"; // Host del database
                      $dbuser = ""; // Username database (specificalo)
                      $dbpass = ""; // Password database, se non c'è lascia vuoto
                      $dbname = ""; // Nome del database (specificalo)
                      
                      $db = mysql_connect($dbhost, $dbuser, $dbpass);
                      mysql_select_db($dbname, $db);
                      $query = mysql_query("SELECT id_user, date FROM messaggi ORDER BY date DESC limit 1", $db);
                      while($riga = mysql_fetch_assoc($query)) {
                      $id_user = $riga['id_user']; }
                      $id_cartella = substr($id_user, -1, 1);
                      $cartella = "fotos/".$id_cartella;
                      $image_src ="fotos/" . $id_cartella . "fotos/"."1" . ".jpg";
                      echo "<img src=\"$image_src\">";
                      
                      // Quello che vuoi inserire nel campo id_cartella
                      $ins = ""; // Specificalo
                      
                      
                      // Qui inserisce i dati nel database
                      mysql_query("INSERT INTO messaggi (id_cartella) VALUES(\"".$ins."\")", $db);
                      
                      
                      
                      // Disconnessione dal database
                      mysql_close($db);
                      ?>
                      

                      Fammi sapere... 🙂

                      1 Risposta Ultima Risposta
                      Miglior risposta 0
                      0
                      • G
                        G
                        giorgiodp
                        scritto su ultima modifica di
                        User Attivo 0
                        #13

                        $id_cartella = substr($id_user, -1, 1);
                        $cartella = "fotos/".$id_cartella ;
                        $image_src ="fotos/" . $id_cartella . "fotos/"."50" . ".jpg";
                        echo "<img src="$image_src">";
                        $ins = "$id_cartella";
                        ?>

                        lo porto con la sessione alla pagina successiva:

                        <?php
                        session_start();
                        $_SESSION['id_cartella'] = $_INS ['id_cartella'];
                        ?>

                        alla terza inserisco:
                        <?php
                        session_start();
                        ?>

                        <?php

                        $connessione=mysql_connect("localhost", "");
                        $selezione_db=mysql_select_db("guest_book", $connessione);
                        $id_cartella = $_SESSION['id_cartella'];
                        $user = $_SESSION['user'];
                        $gender = $_SESSION['gender'];
                        $year=$_SESSION['year'];
                        $month=$_SESSION['month'];
                        $day=$_SESSION['day']

                        $query="INSERT INTO messaggi (id_user,id_cartella,user,gender,date_of_birth,country,test_arousal_photo1,test_valence_

                        pero' qui come la scrivo$id_cartella?

                        $query.=" VALUES ('$id_user','$user','$gender','$year-$month-$day','$country

                        1 Risposta Ultima Risposta
                        Miglior risposta 0
                        0

                        Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.

                        Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.

                        Con il tuo contributo, questo post potrebbe essere ancora migliore 💗

                        Registrati Accedi
                        Rispondi
                        • Risposta alla discussione
                        Effettua l'accesso per rispondere
                        • Da Vecchi a Nuovi
                        • Da Nuovi a Vecchi
                        • Più Voti


                        • Accedi

                        • Non hai un account? Registrati

                        • Accedi o registrati per effettuare la ricerca.
                        • Primo post
                          Ultimo post
                        Home Accedi Registrati
                        Menu
                        • CATEGORIES
                        • La Community Connect.gt
                        • Presentati alla Community
                        • News Ufficiali da Connect.gt
                        • Internet News
                        • A Scuola Di
                        • Digital Marketing
                        • Intelligenza Artificiale
                        • SEO & GEO
                        • Web Marketing e Content
                        • Google Analytics e Web Analytics
                        • Google Ads & Advertising
                        • YouTube
                        • TikTok, Instagram e altri Social
                        • Google Adsense, Affiliazioni e Guadagno
                        • E-Commerce
                        • Coding e Sistemistica
                        • Help Center: consigli per il tuo progetto
                        • Hosting e Cloud
                        • Coding
                        • CMS & Piattaforme Self-Hosted
                        • Annunci e Collaborazioni
                        • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
                        • Collaborazioni WEB e Lavoro: offro e cerco
                        • Impresa, Fisco e Leggi
                        • Consulenza Legale e Professioni Web
                        • Consulenza Fiscale, Imprese, Startup e P.Iva
                        • Gli Off Topic
                        • PC, Smartphone e altri Hardware
                        • Tutti i Software
                        • GT Fetish Cafè
                        • Discussioni
                        • Non letti 0
                        • Recenti
                        • Hashtag
                        • Popolare
                        • Utenti
                        • Privacy
                        • Termini e condizioni
                        • © 2026 Search On Media Group S.r.l.