Another problem I’ve come across is this one. I’m trying to call this function from another function but the SQL query is giving me this error:
Catchable fatal error: Object of class mysqli could not be converted to string in …..
I’m clueless as to why this keeps occurring. Could someone please explain to me why this fatal error wont go away? I’m using procedural statements.
function answered($you, $dbc)
{
$SQLanswered = "SELECT readcount FROM Faq WHERE sender = '$you' ";
$Ranswered = mysqli_query ($dbc. $SQLanswered)
or trigger_error("Query: $SQLanswered\n<br />MySQL Error: " . mysqli_error($dbc));
while($row = mysqli_fetch_assoc($Ranswered))
{
$answered[] = $row['readcount'];
}
mysqli_free_result($Ranswered);
for($i = 0; $i < sizeof($answered); $i++)
{
$num += $answered[$i];
}
if($num > 0)
{
echo " <a href='extrainfo.php'>($num answered)</a>";
}
}
Shouldn’t that be
?
Looks like you’re accidentally doing string concatenation.