Visualizzazione dei risultati da 1 a 5 su 5
  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2008
    Messaggi
    40

    Problema stranissimo con query e tabelle

    ciao a tutti..ho creato una pagina web di un browser game che sto progettando, in questa pagina, mostro il profilo del giocatore, un breve campionato, e le statistiche sotto..ma il problema è che da quando ho messo la query delle statistiche..la query che visualizza il campionato non si vede più! e se tolgo una visualizzo l'altra..è stranissimo..non mi è mai capitato..ecco il codice

    Codice PHP:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    .style1 {color: #FFFFFF}
    a:link {
        text-decoration: none;
    }
    a:visited {
        text-decoration: none;
    }
    a:hover {
        text-decoration: none;
    }
    a:active {
        text-decoration: none;
    }
    -->
    </style>
    </head>

    <body height:100%,margin:0>
    <div align="center">[img]http://localhost/manager/html/images/banner1.jpg[/img]</div>
               
     [url="index.php"] [img]http://localhost/manager/html/images/clubhus.jpg[/img] [/url]
     [url="squadra.php"] [img]http://localhost/manager/html/images/squadra.jpg[/img][/url]
     [url="trans.php"] [img]http://localhost/manager/html/images/trasfer.jpg[/img][/url]
     [url="league.php"] [img]http://localhost/manager/html/images/campionato.jpg[/img][/url]
     [url="forum.php"] [img]http://localhost/manager/html/images/forum.jpg[/img][/url]

     <div align="center" >[img]http://localhost/manager/html/images/banner2.jpg[/img]</div>
      
      
      <center>
      [img]http://localhost/manager/html/images/showprofile.jpg[/img]
      </center>
        <tr>
        <p style="position:absolute; left:344px; top:335px;"><? 
    @include "config.php";
    $id=$_GET['id'];
    $query=mysql_query("SELECT * FROM giocatore,qualita,foto WHERE giocatore.id_f=foto.id_f AND giocatore.id_set=qualita.id_set AND id_g= $id");
    $query=mysql_fetch_assoc($query);
    echo 
    $query['forza'];
    ?>


    <? echo $query['resistenza']; ?> 

    <? echo $query['velocita']; ?>

    <? echo $query['marcatura']; ?>

    <? echo $query['contrasto']; ?>

    <? echo $query['passaggi']; ?>

    <? echo $query['posizione']; ?>

    <? echo $query['colpo_d_t']; ?>

    <? echo $query['cross_1']; ?>



    <? echo $query['finalizzazione']; ?></p>
    [img]<? echo $query['path'];?>[/img]



    <? 
    $camp
    =mysql_query("SELECT nome_s,punti FROM squadra,giocatore,posizione,campionato WHERE squadra.id_s=posizione.id_s AND campionato.id_c = squadra.id_c AND squadra.id_s = giocatore.id_s AND posizione.id_c=campionato.id_c AND giocatore.id_s = $id");
    $numc=mysql_num_rows($camp);
    $camp=mysql_fetch_assoc($camp);?>
      <table width="625" height="25" border="0" align="center" cellpadding="0" background="http://localhost/manager/html/images/stat_sopra.jpg"style="position:absolute left:380px; top:335px;">
      <tr>
            <td align="left" > A  </td>
            <td>      Squadra</td>
            <td>  Naz </td>
            <td>  Gio</td>
            <td>  Gol</td>
            <td>  Ass</td>
            <td>  Pro</td>
            </tr>
    </table>
    <table width="625" height="25" border="0" align="center"  background="http://localhost/manager/html/images/stat_sopra.jpg">
    <?
        $stat
    =mysql_query("SELECT nome_s,foto,giocate,gol,assist,eta,stagione FROM squadra,giocatore,storici,nazioni WHERE squadra.id_s=giocatore.id_s AND squadra.id_s=storici.id_s AND storici.id_g=giocatore.id_g AND nazioni.id_n=giocatore.id_n AND giocatore.id_g=$id");
        while (
    $stat1=mysql_fetch_assoc($stat) or die(mysql_error())){?>
    <tr>
        <td><? echo $stat1['stagione']; echo $stat1['nome_s'];?>[img]<?echo $stat1['foto']?>[/img]<?echo $stat1['giocate'];?></td>
    </tr>
    <?}?>
    </table>
    <table cellpadding="0,1" cellspacing="0,1"  style="position:absolute; left:710px; top:360px;">
    <? $clax=mysql_query("SELECT squadra.id_s,squadra.nome_s,punti FROM squadra,posizione WHERE squadra.id_s=posizione.id_s AND squadra.id_c = posizione.id_c ORDER BY punti DESC");
    $x=0;
    while (
    $elenco=mysql_fetch_assoc($clax) or die(mysql_error())) { 
    $x++;
    $id1=$elenco['id_s'] ;
    ?>
    <tr>

      <td cellpadding="0"; align= "left"><?php echo $x?> </td>
      <td cellpadding="0"; align= "left" style=" padding-bottom:inhpadding: 0 px; margin:0 px;">[url='squadra.php?id_s= <?   echo $id1?>'] <span class="style1" style=" font-size:11px">  <?php echo $elenco['nome_s']; ?></span>[/url]</td>
      <td cellpadding="0"; align= "right"><?php echo $elenco['punti']; ?></td>
      
    </tr>


    <?php ?>
    </table>

        </tr>

    <? 
    @include "config.php";
    $id=$_GET['id'];
    $query2=mysql_query("SELECT * FROM giocatore,qualita WHERE  giocatore.id_set=qualita.id_set AND id_g= $id");
    $query2=mysql_fetch_assoc($query2);
    echo 
    $query2['resistenza'];?>

    </p>
    </body>
    </html>
    Vi prego mi serve una mano

  2. #2
    Utente di HTML.it
    Registrato dal
    Nov 2008
    Messaggi
    209
    ad occhio, credo che ci sia uno spazio in più nella query.
    Cmq quando usi le query è sempre bene usare mysql_error accanto a mysql_query

    Codice PHP:
    $risorsa=mysql_query("SELECT x FROM y WHERE z") or die(mysql_error()) 
    Cmq questo progetto mi sembra interessante, dove lo si può vedere in funzione?

  3. #3
    Utente di HTML.it
    Registrato dal
    Jun 2008
    Messaggi
    40
    in quale query scusa?

    Il progetto è per la mia maturità..appena lo completerò lo metterò online e vi posterò il link su questo sito

  4. #4
    Utente di HTML.it
    Registrato dal
    Nov 2008
    Messaggi
    209
    guardando meglio.. è questa la query problematica, vero?

    Codice PHP:
    <?     
    $stat
    =mysql_query("SELECT nome_s,foto,giocate,gol,assist,eta,stagione FROM squadra,giocatore,storici,nazioni WHERE squadra.id_s=giocatore.id_s AND squadra.id_s=storici.id_s AND storici.id_g=giocatore.id_g AND nazioni.id_n=giocatore.id_n AND giocatore.id_g=$id");
    while (
    $stat1=mysql_fetch_assoc($stat) or die(mysql_error())){?>
    mysql_error ti da errori di sintassi della query, devi usarlo assieme a mysql_query, non con mysql_fetch_assoc.
    Prima di tutto, fai questo per vedere eventuali errori.

  5. #5
    Utente di HTML.it
    Registrato dal
    Jun 2008
    Messaggi
    40
    cavolo, hai ragione, fatto e ora funziona, problema stupidissimo, l'ho fatto perchè mi dava un errore sul fetch_assoc e non sapevo quale, così ho guardato in quel modo...grazie mille!!!!ti farò sapere appena completo

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.