<?

include("db.php");

mysql_connect($host,$username,$password);
@mysql_select_db($database) or die("Unable to connect to database");

$query="SELECT * FROM tcg";

$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

echo "<center>Viewing Records</center>";

$i=0;
while ($i < $num) {

$client = mysql_result($result,$i,'ClientsName');
[B]$prgno = mysql_result($result,$i,'PrgNo'); this is line31[/B]
$prgname = mysql_result($reslt,$i,'PrgName');
$trainername = mysql_result($result,$i,'TrainerName');
$dates = mysql_result($result,$i,'Dates');
$days = mysql_result($result,$i,'Days');
$proffee = mysql_result($result,$i,'ProfFee');
$trainerfee = mysql_result($result,$i,'TrainerFee');
$reimbexp = mysql_result($result,$i,'ReimbExp');
$handoutchg = mysql_result($result,$i,'HandoutChg');
$invoiceno = mysql_result($result,$i,'InvoiceNo');
$totalinvamt = mysql_result($result,$i,'TotalInvAmt');
$feerecd = mysql_result($result,$i,'FeeRecd');


echo "$client <br> $prgno <br> $prgname <br> $trainername <br> $dates <br> $days <br> $proffee <br> $trainerfee <br> $reimbexp<br> $handoutchg <br> $invoiceno <br> $totalinvamt <br> $feerecd <br>";



$i++; }

$addition = $proffee+$trainerfee;

echo "The toal receivable amount after tds deduction is ie.(prof fee + trainer fee) ".$addition;


?>

The error says Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /www/host/folder/out.php on line 31

The problem is with only this line 31

and the rest of the code is processed without any errors.
If I put a # in front of line 31 there is no error displayed.

Please Help.

$prgno = mysql_result($result,$i,'PrgNo'); this is line31 --- make sure this field PrgNo exist or spelling might be incorrect.

$prgname = mysql_result($reslt,$i,'PrgName'); -- as you notice $reslt is wrong spelling, try to correct this one. Probably this is the one causing the error even it's pointing ot line 31

Comments
well spotted :)

Hei Dreamluverz,

Thanks, it was the spelling mistake "reslt" changed to "result". It works now. Thank you again.

This question has already been answered. Start a new discussion instead.