试图做注册显示在mysql


trying to do registration to display in mysql

嗨,我是一个真正的新手,我在做一个非常简单的项目,不需要安全或任何

我试图做一个注册页面,并显示信息到我的php页面,我看了很多指南,仍然发现它非常混乱

这些是我的代码

这是我的显示表在我的php,工作

<?php
mysql_connect('localhost','root','');
mysql_select_db('login');
$sql="SELECT * FROM registranttb";
$records=mysql_query($sql);
?>
 <table width="600" border="1" cellpadding="1" cellspacing="1">
     <tr>

 <th>Name</th>
 <th>Course Applied for</th>
 <th>Email</th>
 <th>Contact Number</th>
 <th>Registration Date</th>
 <tr>
 <h1>Course</h1>
     <?php 
    while($registranttb=mysql_fetch_assoc($records)) {
echo "<tr>";

echo "<td>".$registranttb['Name']."</td>";
echo "<td>".$registranttb['Course']."</td>";
echo "<td>".$registranttb['Email']."</td>";
echo "<td>".$registranttb['Contact']."</td>";
echo "<td>".$registranttb['Date']."</td>";
   }
   ?>

我不知道从这里开始做什么....顺便说一句,当我在mysql中编辑文件时,它可以显示

的信息

您的HTML不正确。您不能在<tr>标签之间输出<h1>,并且您不能关闭<tr>标签或<table>标签。

<h1>Course</h1>
<table width="600" border="1" cellpadding="1" cellspacing="1">
  <tr>
    <th>Name</th>
    <th>Course Applied for</th>
    <th>Email</th>
    <th>Contact Number</th>
    <th>Registration Date</th>
  <tr>
<?php while($registranttb=mysql_fetch_assoc($records)) { ?>
  <tr>
    <td><?php echo $registranttb['Name'] ?></td>
    <td><?php echo $registranttb['Course'] ?></td>
    <td><?php echo $registranttb['Email'] ?></td>
    <td><?php echo $registranttb['Contact'] ?></td>
    <td><?php echo $registranttb['Date'] ?></td>
  </tr>
<?php } ?>
</table>