0
<?php
$tname=$_POST['tname'];
$uname=$_SESSION['user'];
include('db_connect.php');
$sql="SELECT marks FROM marks WHERE uname='$uname' && tname='$tname'";
$data=mysql_query($sql);
$marks=$data['marks'];
echo $marks;
echo $uname;
echo $tname;
?>

When I am trying to retrieve data marks is not retrived its displaying as "Marks" Please help

Edited by diafol: reformatted code tags

3
Contributors
2
Replies
5
Views
5 Years
Discussion Span
Last Post by niranga
0

$data is a result object. You have to fetch array from it like follows

$row = mysql_fetch_array($data, MYSQL_ASSOC);
$marks = $row['marks'];
echo $marks;

OR you can replace $row = mysql_fetch_array($data, MYSQL_ASSOC); by $row = mysql_fetch_assoc($data);

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.