<tbody>
<?php
$teacher_subject_query = mysql_query("select * from teacher_suject where teacher_id='$session_id'") or die(mysql_error());
$teacher_row = mysql_fetch_array($teacher_subject_query);
$subject_id = $teacher_row['subject_id'];
$query = mysql_query("select * from subject where subject_id = '$subject_id'") or die(mysql_error());
while ($row = mysql_fetch_array($query)) {
$id = $row['subject_id'];
?>
<!-- script -->
<script type="text/javascript">
$(document).ready(function(){
$('#d<?php echo $subject_id; ?>').tooltip('show')
$('#d<?php echo $subject_id; ?>').tooltip('hide')
});
</script>
<!-- end script -->
<!-- script -->
<script type="text/javascript">
$(document).ready(function(){
$('#e<?php echo $subject_id; ?>').tooltip('show')
$('#e<?php echo $subject_id; ?>').tooltip('hide')
});
</script>
<!-- end script -->
<tr class="odd gradeX">
<td><?php echo $row['subject_code']; ?></td>
<td><?php echo $row['subject_title']; ?></td>
这些是我使用的代码,但系统中只显示一条记录,我需要全部显示!提前谢谢!
答案 0 :(得分:1)
必须只有一条记录符合您的查询:
$query = mysql_query("select * from subject where subject_id = '$subject_id'") or die(mysql_error());
您正在通过ID获取特定主题。
答案 1 :(得分:0)
使用
$ teacher_subject_query = mysql_query(“select * from teacher_suject”)或die(mysql_error());