Visualizzazione dei risultati da 1 a 3 su 3

Discussione: problema mysql_result

  1. #1
    Utente di HTML.it
    Registrato dal
    Jul 2015
    Messaggi
    6

    problema mysql_result

    sul sito mi esce qst errore: Warning: mysql_result() expects parameter 1 to be resource, object given in

    codice da me usato :

    Codice PHP:
    <div>  
                <? 
                $query 
    "SELECT c.CAS_ID, c.TITOLO, i.NOME,c.DES_BREVE,c.DESC_ESTESA,c.OFFERTA_SPECIALE FROM `CASE` c LEFT JOIN `IMMAGINI` i ON c.CAS_ID = i.CAS_ID where VISIBLE = 1 and DEF = 1 and HOME = 1 order by c.CAS_ID DESC"
                
    $result mysqli_query($mysqli $query); 
                
    $num mysqli_num_rows($result); 
                
    $i=0
                
    $count 1
                while (
    $i $num && $i <5) { 
                    
    $id_case[] = mysqli_result($result,$i,"CAS_ID"); 
                    
    ?> 
                        <a style="border:1px solid #e2001a; margin-bottom:10px; display:block;" class="box_case" href="javascript:;" onClick="showCasa('bigbox_<? echo mysql_result($result,$i,"CAS_ID");?>'); updateStatCasa(<? echo mysql_result($result,$i,"CAS_ID");?>)">  
                            <table border="0" cellpadding="0" cellspacing="0" width="100%"> 
                                <tr> 
                                    <td style="padding:15px 0 15px 15px; cursor:pointer;" width="120" align="center" valign="top"><img src="<?php echo mysql_result($result,$i,"NOME"); ?>" height="90" /></td> 
                                    <td style="padding:15px 15px 15px 10px; cursor:pointer;" valign="top"> 
                                        <span style="font-weight:bold; font-size:12px; color:#13007d;"><?php echo mysql_result($result,$i,"TITOLO"); ?></span>  
                                        <br /> 
                                        <?php echo mysql_result($result,$i,"DES_BREVE"); ?> 
                                    </td> 
                                </tr> 
                            </table> 
                        </a> 
                    <? $i++;$count++; 
                } 
    ?> 
            </div>
    nella riga 5 e 6 ho aggiunto la ' i ' alla funzione mysql e funziona, ma nella mysql_result nn va..
    guardato anke il manuale php, ma nn riesco..
    potreste darmi una mano?
    grazie a tutti!!

  2. #2
    Utente di HTML.it L'avatar di .Kurt
    Registrato dal
    Jul 2007
    Messaggi
    654
    mysql e mysqli sono due api differenti.

  3. #3
    Utente di HTML.it
    Registrato dal
    Jul 2015
    Messaggi
    6

    risolto cosi

    Codice PHP:
    <div> 
                <?
                $query 
    "SELECT c.CAS_ID, c.TITOLO, i.NOME,c.DES_BREVE,c.DESC_ESTESA,c.OFFERTA_SPECIALE FROM `CASE` c LEFT JOIN `IMMAGINI` i ON c.CAS_ID = i.CAS_ID where VISIBLE = 1 and DEF = 1 and HOME = 1 order by c.CAS_ID DESC";
                
    $result mysqli_query($mysqli $query);
                
    $num mysqli_num_rows($result);
                
    $i=0;
                
    $count 1;
                 while (
    $row mysqli_fetch_assoc($result)) {?>
                        <a style="border:1px solid #e2001a; margin-bottom:10px; display:block;" class="box_case" href="javascript:;" onClick="showCasa('bigbox_<? echo $row["CAS_ID"];?>'); updateStatCasa(<? echo $row["CAS_ID"];?>)"> 
                            <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                <tr>
                                    <td style="padding:15px 0 15px 15px; cursor:pointer;" width="120" align="center" valign="top"><img src="<?php echo $row["NOME"]; ?>" height="90" /></td>
                                    <td style="padding:15px 15px 15px 10px; cursor:pointer;" valign="top">
                                        <span style="font-weight:bold; font-size:12px; color:#13007d;"><?php echo $row["TITOLO"]; ?></span> 
                                        <br />
                                        <?php echo $row["DES_BREVE"]; ?>
                                    </td>
                                </tr>
                            </table>
                        </a>
                    <? $i++;$count++;
                } 
    ?>
            </div>

Tag per questa discussione

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 © 2024 vBulletin Solutions, Inc. All rights reserved.