请问你如何优化我的询问。 我想从同一表格中抽取10个不同的数据。
www.un.org/spanish/ecosoc 这里是查询之一。
$query1 = mysql_query("SELECT m.Course_code AS Course , m.score, m.grade
FROM maintable AS m
INNER JOIN students AS s ON
m.matric_no = s.matric_no
INNER JOIN Courses AS c ON
m.Course_code = c.Course_code
WHERE m.matric_no = ".$matric_no."
AND m.semester_name = hamattarn
AND m.level = 100 ") or die (mysql_error());
$number_cols1 = mysql_num_fields($query1) ;
<>查询的这一部分正在对所有询问进行改动。
AND m.semester_name = hamattarn
AND m.level = 100 "
AND m.semester_name = rain
AND m.level = 100 "
AND m.semester_name = hamattarn
AND m.level = 200 "
AND m.semester_name = rain
AND m.level = 200 "
AND m.semester_name = hamattarn
AND m.level = 300 "
AND m.semester_name = rain
AND m.level = 300 "
AND m.semester_name = hamattarn
AND m.level = 400 "
AND m.semester_name = rain
AND m.level = 400 "
AND m.semester_name = hamattarn
AND m.level = 500 "
AND m.semester_name = rain
AND m.level = 500 "
这里描述了我能以问答方式实现的目标。 在优化之后,我仍然希望它研究这种方式。
< href=“http://i.imgur.com/IGEj2.png”>Sample 地图
感谢你们的时间和耐心。
<>UPDATE——这里指的是,在优化之前,如何从每10个询问中显示浏览表。 请如何在新优化的提问中实现这种表格类型?
echo "<table class="altrowstable" id = " bgcolor = gold >
";
echo "<tr align=center>
";
for ($i=0; $i<$number_cols10; $i++)
{
echo "<th>" . mysql_field_name($query10, $i). "</th>";
}
echo "</tr>
";
while ($row = mysql_fetch_row($query10))
{
echo "<tr align=center>
";
for ($i=0; $i<$number_cols10; $i++)
{
echo "<td>";
if (!isset($row[$i]))
{echo "NULL";}
else
{
echo "<b>".$row[$i]."</b>";
}
echo "</td>
";
}
echo "</tr>
";
}
echo "</table>";
echo"</span>" ;
感谢