-1

how to solve this error: Warning: mysql_result() expects parameter 1 to be resource, object given in D:

$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[]=mysql_result($result,$i,"CAS_ID");
}
helmbert
  • 32,364
  • 11
  • 82
  • 89
djdj
  • 11
  • 1
  • 1
    Could you show us your code and how this is appearing? – Filipe Ferreira Jul 06 '15 at 12:59
  • You have an error in your query print your query first and than run you query, you can got the error of the query – Ajeet Kumar Jul 06 '15 at 13:02
  • $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[]=mysql_result($result,$i,"CAS_ID"); ?> – djdj Jul 06 '15 at 13:28

1 Answers1

1

You should either use the PHP MySQLi improved extension here, or the original MySQL API for all your database queries. Don't mix both of them. I suggest you stick to the improved one.

Nisse Engström
  • 4,636
  • 22
  • 26
  • 40
danleyb2
  • 973
  • 12
  • 18