doumou3883 2017-04-29 20:22
浏览 66

保留输入值0(PHP,MySql)

I want to show the students' grades. This is what I have in prueba.php

Image of web browser

And I have this on my table qualifications in my database: Image of Database

How can I leave students who do not qualifications with an input value of 0?

This is my code of prueba.php

    <table>
    <tbody>
<?php
$connect = mysql_connect("localhost","root", "");
if (!$connect) {
die(mysql_error());
}
mysql_select_db("liceo");
$results = mysql_query("SELECT rut, nombre, apellido FROM alumnos") or die(mysql_error);
while($row = mysql_fetch_object($results)) {
$rut = $row->rut;

$results2 = mysql_query("SELECT nota FROM notas WHERE rut_alumno = '$rut' LIMIT 1");
?>
<tr>
<td><?=$row->rut?></td>
<td><?=$row->nombre?></td>
<td><?=$row->apellido?></td>
<td>

<?php
while($nota = mysql_fetch_object($results2)):
?>
<input type="text" name="pin" maxlength="2" size="2" value="<?=$nota->nota?>">
<?php
endwhile;
?>
</td>
</tr>

<?php
}
?>
</tbody>
</table>

展开全部

  • 写回答

0条回答 默认 最新

      编辑
      预览

      报告相同问题?

      手机看
      程序员都在用的中文IT技术交流社区

      程序员都在用的中文IT技术交流社区

      专业的中文 IT 技术社区,与千万技术人共成长

      专业的中文 IT 技术社区,与千万技术人共成长

      关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

      关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

      客服 返回
      顶部