Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2012
    Messaggi
    95

    Warning: mysql_num_rows() expects parameter 1 to be resource

    Ho un elenco di categorie, con questo codice lo organizzo in 4 colonne.
    Il codice l'ho preso già fatto e poi adattato.
    Ma ho questo errore:
    Warning: mysql_num_rows() expects parameter 1 to be resource, string given... on line 81:
    81) $num_record = mysql_num_rows($queryCat);

    Codice PHP:
    <?php
                            $nomeTabellaCat 
    $tbl_prefix."categorie_lavoro";
                            
    $queryCat "SELECT * FROM $nomeTabellaCat ORDER BY nome ASC";
                            
    $sqlCat = @mysql_query($queryCat);

                            
    // $query = @mysql_query("SELECT * FROM tbl_image_gallery");
                            // $row_rs_imagegallery = mysql_fetch_assoc($query);
                            
    $num_record mysql_num_rows($queryCat);
                            
    $colonne 4;
                            
    $tot_righe $num_record/$colonne;
                            
    $i_x 0;
                            
    $x_x 0;
                            
    $k_x 0;
                            
    $cell_width floor(100/$colonne);

                            echo 
    '<table border="0" cellspacing="1" cellpadding="3"><tr>';
                            while (
    $datiCat mysql_fetch_array($sqlCat))

                            {
                            
    $urlCat $datiCat['url_cat'];
                            
    $nomeCat htmlentities(stripslashes($datiCat['nome']));
                            
    $i_x++;
                            
    $x_x++;
                            
    $k_x++;

                            echo (
    '<td width=\"$cell_width%\" border=0 align=top />[url="'.$docRoot.'tpl_lavoro_cat.php?cat='.$urlCat.'"]'.$nomeCat.'[/url]');

                            if(
    $i_x == $colonne) { echo'</tr>';
                            if (
    $i_x == $colonne && (($x_x/$colonne) != $tot_righe)) { echo'<tr>';
                            } 
    $i_x 0;
                            } 
                            } if (
    $colonne <= $x_x){ if (($k_x%$colonne) != 0){
                            
    $indice $k_x;
                            while ((
    $indice%$colonne) != ){
                            
    // echo'<td></td>';
                            
    $indice++;
                            }

                            if((
    $indice%$colonne) == ){ echo'</tr>';
                            }
                            }
                            }
                            else{ echo 
    '</tr>';
                            }
                            echo 
    '</table>';
                            
    ?>
    Grazie

  2. #2
    Prova a modificare il codice:
    codice:
    		$sqlCat = @mysql_query($queryCat); 
    		
    		$num_record = mysql_num_rows($queryCat);
    in questo modo
    codice:
    		$sqlCat = @mysql_query($queryCat); 
    		
    		$num_record = mysql_num_rows($sqlCat);
    Facci sapere
    Mik

  3. #3
    Utente di HTML.it
    Registrato dal
    Oct 2012
    Messaggi
    95
    Che testa !
    Grazie mille!!!!

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.