Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 11
  1. #1

    Warning: mysql_num_rows():

    Scusatemi sono molto Noob!!
    Volevo adattare uno script per le news al mio sito, ma mi sono bloccato a questo punto e cioè Warning: mysql_num_rows():

    Il fatto strano è che lo fà anche con il file originale in rete, mentre in locale è tutto funzionate.

    Lo script:
    <HTML>
    <?
    require("connect.php"); //Including the language.inc
    require($lang); //Including the config_style.inc which gives extra config oportunity require($style); ?> <HEAD> <title><? echo $headtitle; ?></title> <? // Using CSS echo'<LINK rel="stylesheet" href="'.$css.'">'; ?> </HEAD> <body bgcolor=<? echo($bodycolor); ?>> <?php //Connecting to Database and reading number of entries $result = @mysql_query ("select * from $table_news order by news_date DESC"); $num = @mysql_num_rows($result); // Starting the Output-List ?> <table border="1" cellpadding="0" cellspacing="1" width="500" align="center"> <?PHP while($i < $num) { echo '<TR><TD valign="middle" align="left" width="6"><FONT size="'.$preview_news_text_fontsize.'" face="'.$output_fontface.'">[img]'.$path_tag_pic.'[/img]'; echo '</FONT></TD><TD valign="middle" align="left" width="70"><FONT size="'.$preview_news_text_fontsize.'" face="'.$output_fontface.'">'; echo mysql_result($result,$i,"news_day"); echo "-"; echo mysql_result($result,$i,"news_month"); echo "-"; echo mysql_result($result,$i,"news_year"); echo "</FONT></TD>"; echo '<TD valign="middle" align="left" width="420"><FONT size="'.$preview_news_text_fontsize.'" face="'.$output_fontface.'"><A HREF=show_news.php?uid='; echo mysql_result($result,$i,"uid"); echo ">"; echo mysql_result($result,$i,"news_title"); echo '</A> </FONT><FONT size="'.$hits_fontsize.'" face="'.$hits_fontface.'">('; echo mysql_result($result,$i,"news_hits"); echo " Hits)"; echo "</FONT></TD></TR><TR></TR>"; $i++; }; ?> </TABLE>

    </body> </HTML>


    Siceramente nn so il motivo di questo errore, help me!
    Saluti
    GaSe

  2. #2
    warning non e' un errore, cosa ti dice dopo?

    ciao
    sergio

  3. #3
    Esattamente questo:

    codice:
    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in
    Scusa, allora sto Warning da dove spunta, che mi vuole segnalare?
    Saluti
    GaSe

  4. #4
    metti lo script in modo piu' intelleggibile. Usa il tag code invece del corsivo...

    Il silenzio è spesso la cosa migliore. Pensa ... è gratis.

  5. #5
    codice:
    <html>  
    <?  require("connect.php");  //Including the language.inc  
    require($lang);  //Including the config_style.inc 
    require($style);  
    ?> 
     <head>  	
    <title>Untitled</title>  
    </head>   
    
     <body>      		
    <table width="990" height="100%">  		
    <tr>  			
    <td height="45" background="http://www.fifaclubs.com/pes/images/cap01.png">  			  				
    <?php  				
    $connect = @mysql_connect($dbhost, $dbuser, $dbpasswd) or die ("Non connesso");  				
    @mysql_select_db($db_name);  				
    $query = "SELECT * FROM $table_news ORDER BY uid DESC LIMIT 1";  	
    $esegui = @mysql_query($query, $connect);  
    while ($result = @mysql_fetch_array($esegui)) 
    {  				
    echo "<div class=title style=padding-left:62px;padding-top:10px;padding-right:5px;color:#ffffff;>  							
    $result[news_title]
      				
    </div>  				  				  				
    </td>  						
    </tr>  						
    <tr>  							
    <td width=502 height=250 background=http://www.fifaclubs.com/pes/images/bg02.jpg valign=top> 
    			  				
    <table  width=480 height=200 cellspacing=2 cellpadding=2 border=0>  						
    <tr>  							
    <td valign=top align=left>  				  							
    <div style=padding-left:20px;padding-top:10px;padding-right:5px;color:#ffffff; align=justify>   
    
    $result[news_short]
    
      				
    $result[news_long]";  				  				
    }  				  				
    ?>  				
    </div>
      	
     </td>  		
    </tr>  		
    </table>      
    </body>  
    </html>
    Saluti
    GaSe

  6. #6
    @mysql_query ("select * from $table_news order by news_date DESC"); $num = @mysql_num_rows($result);


    devi impostare $result = mysql_query ...... prima di chiamare mysql_result

    ciao
    sergio

  7. #7
    scusa mi postersti il codice modificato, xkè non riesco e da 15 minuti che scrivo codice, ma il risultato è sempre quello.
    Brutto essere NOOB!
    Saluti
    GaSe

  8. #8
    Originariamente inviato da mondobimbi
    @mysql_query ("select * from $table_news order by news_date DESC"); $num = @mysql_num_rows($result);


    devi impostare $result = mysql_query ...... prima di chiamare mysql_result

    ciao
    sergio
    fai cosi'

    $query = "select * from $table_news order by news_date DESC");
    $risultato = mysql_query($query) or die ($query . ":" . mysql_error());
    $num = @mysql_num_rows($result);

    ciao
    sergio

  9. #9
    Ma sono due script differenti... quello in corsivo e' uno, quello tra tag code un'altro... :master:

    Il silenzio è spesso la cosa migliore. Pensa ... è gratis.

  10. #10
    non saprei se e' colpa del mio browser ma li leggo malissimo,
    tutti su una riga e mi devo spostare con lo scroll orizzontale.

    ciao
    sergio

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.