I have a problem with mysqli syntax. I really can't see what the problem is in this code. I dont know much about it.
When i use it on a function like this
public function Somefunction()
{
$query=mysqli_query($this->db,"SELECT title,url,img FROM table WHERE status='1' ORDER BY id DESC")or die(mysqli_error($this->db));
while($row=mysqli_fetch_array($query,MYSQLI_ASSOC))
{
$data[]=$row;
}
return $data;
}
its ok when i am trying to use it like i did natively on a page it doesnt work.
<?php
echo '<label style="font-size:16px">'. $message.'</label><label> at </label>
<a style="font-size:14px">' .$venue.'</a>';?><br><br/>
<?php echo '<label>'. date('l, F d, Y H:i a', strtotime($dategig)).'</label>';
$query=mysqli_query($this->db,"SELECT fan_count FROM messages WHERE msg_id='$msg_id'")or die(mysqli_error($this->db));
$row=mysqli_fetch_array($query,MYSQLI_ASSOC);
$show1='style="display:block;"';
$show2='style="display:block;"';
if ($row['fan_count'] == 0 )
{
$show1='display:block;';
$show2='display:none;';
}
else {
$show1='display:none;';
$show2='display:block;';
}
?>
what i am missing?