Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Sep 2010
    Messaggi
    1

    Problemino visualizzazione tabella

    codice:
    <?php
    include("param.db.php");
    $query="select * from $_GET[nome] order by id";
    $result= mysql_query($query);
    //$numfields = mysql_num_fields($result);
    $numfields=mysql_num_fields(mysql_query($query));
    
    ?>
    <table>
    	<tr>
    		<td width="152" valign="top">
    		 [img]slide1.jpg[/img]</td>
    	  <td width="903" height="126" align="center" valign="top">
    		 <font face="Arial" size="7">ITIS &quot;B.Focaccia&quot;</font>
    
    
    	  <font face="Arial" size="5"><? echo "$_GET[nome]" ?></font></td>
    	</tr>	
    	<tr align="center"></tr>
    	<tr align="center">
        <td align="center">
    	 <td>
    	 </td>
    	</td>	   	   
    	</tr>
    </table>
    
    <?
    echo "<table align=center border=1 width=100>\n<tr width=100>";
    for ($i=0; $i < $numfields; $i++) 
      { 
       echo '<th width=100 >'.mysql_field_name($result, $i).'</th>'; 
       }
       echo "</tr>\n";
       
       while ($row = mysql_fetch_row($result)) 
      { 
       echo '<tr align=center width=100><td align=center width=100>'.implode($row,'</td><td>')."</td></tr>\n"; 
      }
    echo "</table>\n";
      ?>
    mi genera i seguenti errori:
    1)Warning: mysql_num_fields(): supplied argument is not a valid MySQL result resource in c:\...\www\pagella\vis.php on line 6
    2)Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in c:\...\www\pagella\vis.php on line 34

    Che c'è di sbagliato?

  2. #2
    Ciao,
    l'errore è qui, nella sintassi della query

    Codice PHP:
    $query="select * from $_GET[nome] order by id"
    prova a fare un

    Codice PHP:
    echo $query
    devi usare gli apici.
    prova così

    Codice PHP:
    '".$_GET['nome']."' 
    comunque per vedere l'errore utilizza mysql_error()
    Codice PHP:
    $resultmysql_query($query) or die(mysql_error()); 

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.