Hi,

I am having error in following code,

<!-- START --> 
<p class="date-head"> 
<?php 
$sql_online_mem = "SELECT membername FROM ` trade_messengerd` WHERE status = 'Online'"; 
$db_sql_mem = mysql_query($sql_online_mem); 
while($online_mem = mysql_fetch_array($db_sql_mem)){ 
$members_online[] = $online_mem['membername']; 
} 
for($o=0; $o<count($members_online); $o++){ 
if($members_online[$o] == $uid){ 
$mem_online = "Online"; 
} 
} 
?> 
<a href="#" onClick="window.open('<?=$domain_url?>/messenger/members/_login.php','login','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=368,height=600,left=380,top=60');return false;" title="Chat Now"><?php if($mem_online == 'Online'){ ?>
<img src="<?=$domain_url?>/images/chat_now_online.jpg" alt="Online Chat Now" title="Online Chat Now" height="31" width="159" border="0" />
<?php }else{ ?>
<img src="<?=$domain_url?>/images/chat_now_offline.jpg" alt="Chat Offline" title="Chat Offline" height="31" width="159" border="0" />
<?php } ?></a>
</p>
 <!-- END -->






Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /public_html/offer-new11.php on line 1289
Line # 1289 is     while($online_mem = mysql_fetch_array($db_sql_mem)){ 

Could you please tell me why i am having error and how i can solve it?

Regards,
FHS

Sounds like an error with your SQL syntax;

$sql_online_mem = "SELECT membername FROM ` trade_messengerd` WHERE status = 'Online'"; 

You appear to have an unintended space where trade_messengerd starts in your query where you have enclosed it.

$db_sql_mem = mysql_query($sql_online_mem) or die(mysql_error());

Modify your code to include that. It may help track down any errors in your syntax.

Hi,

Thank you for your email. Now it is not showing any error, But it is not showing member online status. Any idea why?

Regards,
FHS

Hi,

Now everything is fine. Thanks :)

Regards,
FHS

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.