Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    [PHP] Errore visualizzazione SELECT * FROM...

    salve,
    qualche tempo fa ho realizzato un Guestbook semplice semplice e fin quando lo testavo con EasyPHP, tutto bene... il fatto è che ora l'ho provato in rete ma mi da qualche difetto...

    cioè si connette al dbMySql, però non visualizzo i dati... (non mi da nessun errore)...

    è possibile che il problema nasca dal fatto che ho attivo MySql su un dominio WWW mentre, adesso che lo sto testando, l'ho messo nello stesso dominio, ma di terzo livello???

    esempio:

    www.***.it (dove ho attivato SQL)

    ***.***.it (è dove sto testando il php)...

    possibile che il problema nasca da questo fatto?

  2. #2
    Utente di HTML.it
    Registrato dal
    Jun 2005
    Messaggi
    2,125
    prova a connetterti al db da shell e prova a far le query da li
    e vedi che succede....
    non e' che stai usando 2 db differenti ?
    sii piu specifico per l'errore della select..


    ciao

  3. #3
    allora nella pagina "guestbook.php" (dove visualizzo tutti i msg con il ciclo while)..

    uso questo cod:

    Codice PHP:
    <?php 

    include("config.inc.php");
    $db mysql_connect($db_host$db_user$db_psw$db_name) or die ("Errore Di Connessione Al Server"); 
    $conn mysql_select_db($db_name$db) or die ("Errore Di Connessione Al Database"); 

    $query1 mysql_query("SELECT COUNT(id) FROM messaggi");
    $row1 mysql_fetch_array($query1$db);
    echo 
    "
    <html>
    <head>
    <body>
    <table width=\"984\" height=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
      <tr>
        <td align=\"left\" valign=\"top\"><table width=\"984\" height=\"35\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
          <tr>
            <td align=\"center\" valign=\"middle\" class=\"cellatitolo1 Stile3\"><table width=\"100%\" height=\"35\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
              <tr>
                <td width=\"25%\"></td>
                <td width=\"50%\"><div align=\"center\" class=\"Stile6\">Il Libro Degli Ospiti</div></td>
                <td width=\"25%\"><div align=\"center\" class=\"campimodulo\"><a href=\"guestbook/inserisci.htm\">[Inserisci Un Nuovo Messaggio]</a></div></td>
              </tr>
            </table></td>
          </tr>
        </table>
          <table width=\"984\"  border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
            <tr>
              <td height=\"34\" background=\"images/gb_tb_05.jpg\"><div align=\"center\">
                <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
                  <tr>
                    <td><div align=\"center\">[b]
    Nel Libro Sono Presenti 
    $row1[0] Messaggi - Gli ultimi 50, sono i seguenti (ordinati dall'ultimo inserito ai precendenti)
                    [/b]</div></td>
                  </tr>
                </table>
              </div></td>
            </tr>
          </table>  
          <table width=\"100%\" height=\"230\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
            <tr>
              <td valign=\"top\">
    </body>
    </head>
    </html>
    "
    ;
    $query2 mysql_query("SELECT * FROM messaggi ORDER BY id DESC LIMIT 0,50") or die ("Errore Di Selezione Nel Database"); 

    while (
    $row2 mysql_fetch_array($query2$db))

    {echo 
    "
    <html>
    <head>
    <body>

    <table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
      <tr>
        <td align=\"left\" valign=\"top\"><table width=\"984\"  border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
            <tr>
              <td colspan=\"2\" align=\"center\" valign=\"top\">
                <table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
                  <tr>
                    <td width=\"260\" height=\"180\" align=\"center\" valign=\"top\"><table width=\"253\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
                      <tr>
                        <td height=\"35\" align=\"center\" background=\"images/gb_tb_01.jpg\">[b]Inserito Da:[/b]</td>
                      </tr>
                      <tr>
                        <td height=\"44\" align=\"center\" background=\"images/gb_tb_02.jpg\">
    $row2[autore]</td>
                      </tr>
                    </table>
                      

                      <table width=\"253\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
                        <tr>
                          <td height=\"35\" align=\"center\" background=\"images/gb_tb_01.jpg\">[b]L'E-Mail Di 
    $row2[autore] &egrave;: [/b]</td>
                        </tr>
                        <tr>
                          <td height=\"44\" align=\"center\" background=\"images/gb_tb_02.jpg\">
    $row2[mail_autore]</td>
                        </tr>
                      </table>                  </td>
                    <td rowspan=\"2\" align=\"center\" valign=\"top\"><table width=\"700\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
                      <tr>
                        <td height=\"34\" align=\"center\" background=\"images/gb_tb_03.jpg\">[b]Messaggio scritto da 
    $row2[autore] [/b]</td>
                      </tr>
                      <tr>
                        <td align=\"center\" valign=\"middle\" background=\"images/gb_tb_06.jpg\"><table width=\"685\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
                          <tr>
                            <td><div align=\"justify\">
    $row2[msg]</div></td>
                          </tr>
                        </table></td>
                      </tr>
                      <tr>
                        <td height=\"35\" background=\"images/gb_tb_07.jpg\"></td>
                      </tr>
                    </table></td>
                  </tr>
                  <tr>
                    <td></td>
                  </tr>
                </table>
                <table width=\"984\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
                  <tr>
                    <td width=\"984\" height=\"34\" background=\"images/gb_tb_05.jpg\"><table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
                      <tr>
                        <td width=\"25%\" align=\"center\"></td>
                        <td width=\"50%\" align=\"center\">[b]***FINE MESSAGGIO*** [/b]</td>
                        <td width=\"25%\" align=\"center\"></td>
                      </tr>
                    </table></td>
                  </tr>
                </table>            </td>
            </tr>
          </table>
          <table width=\"100%\" height=\"35\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
            <tr>
              <td></td>
            </tr>
          </table></td>
      </tr>
    </table>

    </body>
    </head>
    </html>
     "

    }

    mysql_close($db); 
    ?>
    ---------------------------------------

    Bene... in Easy PHP lo vedo bene.... ma in rete no.... perchè?? non mi da alcun errore il server, ma io non visualizzo niente... ho in pratica i campi vuoti, ma il COUNT ID è esatto...
    Il db è unico... non uso altri...

  4. #4

    ho risolto...

    anche senza aiuto (e vi ringrazio)
    ho risolto tutto...

    il problema stava nella variabile "$row2[autore]", "$row2[mail_autore]", "$row2[msg]"...

    ho dovuto nominarle così' "$row2[1]""$row2[2]""$row2[3]" in pratica come stanno nel database mysql.... (non capisco perchè, ma me ne sono andato per logica)...


    Ok? casomai qualcuno si dovesse trovare nella mia stessa situazione, penso sia questa la risposta...

    ciauz

  5. #5
    sorry... poco chiaro...

    in pratica come stanno le RIGHE nel database mysql...

    id(automatico) = riga 1 (query1)

    autore = riga 1 (query2)
    mail_autore = riga 2 (query2)
    msg = riga 3 (query2)

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.