0

This is my code

<?php
$ebits = ini_get('error_reporting');
error_reporting($ebits ^ E_NOTICE);

mysql_connect("localhost","root","") or die(mysql_error());
echo"Connected to MySQL<br /><hr/>";
mysql_select_db("college") or die(mysql_error());
echo "Connected to database<br /><hr />";

$query = "select student.Rollno, departments.Dept_name, student.Name, student.PercentsgeSoFar from student inner join(departments 
inner join studentdept on studentdept.Dept_id = departments.Dept_id)on student.Rollno = studentdept.Rollno ";

$result =  mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result))
{
echo $row['Rollno']. "  " . $row['Dept_name ']."     ". $row['Name']."     ". $row['PercentageSoFar'];
echo "<br />";
}
?>

The result is :
376 Ankita
789 Arushi
567 Shubham
456 Goldie

Its not showing the other parameters like Dept_name Percentageso far.
Please help, WHAT SHOULD I DO?

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by ankita17gupta
0

$query = "select student.Rollno, departments.Dept_name, student.Name, student.PercentsgeSoFar from student inner join(departments
inner join studentdept on studentdept.Dept_id = departments.Dept_id)on student.Rollno = studentdept.Rollno ";

in the above query use alias names like as shown below:

$query = "select student.Rollno rollno, departments.Dept_name deptname, student.Name sname, student.PercentsgeSoFar percent from student inner join(departments
inner join studentdept on studentdept.Dept_id = departments.Dept_id)on student.Rollno = studentdept.Rollno ";

the print like this:

echo $row['rollno']. "  " . $row['deptname']."     ". $row['sname']."     ". $row['PercentageSoFar'];
0

What if I want the result in this form:


Rollno Dept_name SName Percentage


as in rollno under heading Rollno Department name under the heading Dept_name and so on.

Edited by ankita17gupta: n/a

This topic has been dead for over six months. 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.