$sql="SELECT marks FROM marks WHERE uname='$uname' && tname='$tname'";
echo $marks;
echo $uname;
echo $tname;

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

Recommended Answers

You need to use

$d = mysql_fetch_assoc($data);
$marks = $d['marks'];
Jump to Post

All 2 Replies

Member Avatar

You need to use

$d = mysql_fetch_assoc($data);
$marks = $d['marks'];

$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);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.