Hi everybody,
i recently made a PM system so i was adding the function to check if the user has any PM's if not show a message if so do whatever, but for some reasons even with an empty field mysql still reckons theres some records in there, and yeh, i truncated and its all lies or it could be my inefficent code
but either way heres my code: i spent ages trying to figure out what the problem is and got no where:
PHP Code:
$total_pms = "SELECT count(*) FROM `message` WHERE `myid` = '$sdvariable'";
$result_total_pms = mysql_query($total_pms) or die(mysql_error());
$unread_pms = mysql_query("SELECT count(*) FROM `message` WHERE `myid` = '$sdvariable' AND `flag` = '1'");
echo("You currently have <strong>" .mysql_num_rows($result_total_pms). "</strong> messages and <strong>" .mysql_num_rows($unread_pms). "</strong> unread messages");
if(mysql_num_rows($total_pms) == 0)
{
echo("You currently have no PM's in your inbox!");
}
else
{
... etc ...
can anyone help? thanks