[thelist] php. finding order

Jay Blanchard jay.blanchard at niicommunications.com
Mon Jan 17 08:40:59 CST 2005


[snip]
I have a table in MySql database. It has student_no,
Grade, Lesson, and Visa1 columns. I want to echo a
definite student's order in Visa1 at the same grade
and for the same lesson. 

some thing like that:
You are #.th in your class For Visa 1 in Biology
lesson
[/snip]

<?php
$sql = "SELECT student_no, Grade, Lesson, Visa1 FROM table ";
if(!($results = mysql_query($sql,
$your_connection_string_information))){
	echo mysql_error . "\n";
	exit();
}

while($row = mysql_fetch_array($results)){
	echo "You are " . $row['Visa1'] . "th in your class for Visa 1
in " . $row['Lesson'] . "\n";
}
?>


More information about the thelist mailing list