Mysql_result is not feeling well....T_T
okay this is really wierd... ive used this function in many scripts...
and yet... its NOT WORKING IN THIS ONE...
i get
PHP Code:
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /mounted-storage/home7/sub001/sc13805-XKIN/www/deadlyjynx/etc/private.php on line 9
when i use this
PHP Code:
<?
session_start();
require"conn.php";
?>
<?php
$show = mysql_query("SELECT COUNT(*) AS PM FROM private_message WHERE receiver = '".$_SESSION['user']."'");
$PM = mysql_result($show, 0, "PM");
echo ("(");
if ($PM > 0)
{
echo "<font color=orange>";
}
echo ("$PM");
if ($PM > 0)
{
echo "</FoNt>";
}
echo")";
?>
It's really wierd that its not working... any help would be nice in solving this stupid problem.
Re: Mysql_result is not feeling well....T_T
That error indicates that the query failed. Is the reciever column numeric? If so, take out the quotes. Also, mysql_error() is your friend :)
PHP Code:
$show = mysql_query("SELECT COUNT(*) AS PM FROM private_message WHERE receiver = '".$_SESSION['user']."'");
if (! $show) {
echo(mysql_error());
die;
}
$PM = mysql_result($show, 0, "PM");