I know there have been asked lots of similair questions like this one, but I just can't translate it to my problem so thats why I ask again. The code used to work fine but since the mysql is going to be deprecated I wanted to translate to mysqli.
I receive the following error when trying to read something from database: Catchable fatal error: Object of class mysqli_result could not be converted to string. It refers to line 12, which is
echo $result;
FULL CODE:
$previd ="10";
$query="SELECT * FROM contacts WHERE id='$previd'";
$result = $mysqli->query($query);
echo $result;
$num=$result->num_rows;
$mysqli->close();
echo "<b><center>Database Output</center></b><br><br>";
$i=0;
while ($i < $num) {
$id=mysql_result($result,$i,"id");
$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$phone=mysql_result($result,$i,"phone");
$mobile=mysql_result($result,$i,"mobile");
$fax=mysql_result($result,$i,"fax");
$email=mysql_result($result,$i,"email");
$web=mysql_result($result,$i,"web");
$content=mysql_result($result,$i,"content");
echo "<u>$id</u><b>$first $last</b><br>Phone: $phone<br>Mobile: $mobile<br>Fax: $fax<br>E-mail: $email<br>Web: $web<br><hr><br>$content";
$i++;
}
How can I solve this?