doumou3883 2017-04-30 04: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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)
    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?