<?function messagecount () {global $domain, $db, $userid, $mes;$mes = $db->query(sprintf('Select * from DD_Messages WHERE to_userid='.$userid.' and status="1"')) ;echo $mes;}?>
<?php include ("templates/$template/messagecount.php"); ?>
function messagecount () { global $userid;$message_count = mysql_query('SELECT COUNT(Status) FROM dd_messages WHERE to_userid='.$userid.' AND status=\'1\''); }
<?php $message_count = messagecount();echo $message_count; ?>
function messagecount () { global $userid;$message_count = mysql_query('SELECT COUNT(*) FROM dd_messages WHERE to_userid="$userid" AND status=\'1\''); return $message_count;}
function messagecount () { global $userid, $usrdata;$userid = $usrdata['userid'];$message_count = "SELECT COUNT(*) FROM dd_messages WHERE to_userid='$userid' AND status='0'";$message_count = mysql_query($message_count) or exit (mysql_error());$message_count = mysql_result($message_count,0); return $message_count;
<?phpif(!empty($_SESSION['userid'])){ //the user is signed in so you can echo user info echo $_SESSION['userid'];}else{ //user is not signed in so you can echo a error or do nothing echo "Sorry, but you need to be logged in!";}?>
after the count was working when I called the function instead of just calling I changed so it had the "if(!isset($suserid)) *** else ***" wrapped round it to stop it showing for non logged in users is that ok or should I still change to match your code?Is one more secure that the other?