亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么在 while 循環中結合 php 的 HTML 代碼冷不執行?

為什么在 while 循環中結合 php 的 HTML 代碼冷不執行?

PHP
POPMUISE 2023-09-08 22:09:17
我正在使用 while 在 PHP 代碼中結合 HTML 代碼進行 CRUD 操作。我希望 HTML 代碼在每次執行 while() 后重復。但它給出了錯誤:“解析錯誤:語法錯誤,第 21 行 C:\xampp\htdocs\php\index1.php 中出現意外的 '?> '”。任何人都可以解決這個問題。我已經提到了下面的代碼:       <?php$con=mysqli_connect("localhost","root","","student");$sql="select * from student_php";$res=mysqli_query($con,$sql);?><table>   <tr>      <td>S.No</td>      <td>Name</td>      <td>City</td>      </tr><?php  while($row =mysqli_fetch_assoc($res){  ?>   <tr>      <td>S.No</td>      <td><?php echo $row['name']?></td>      <td><?php echo $row['city']?></td>      </tr>  <?php } ?></table>
查看完整描述

1 回答

?
千巷貓影

TA貢獻1829條經驗 獲得超7個贊

你的 while 循環沒有關閉。

while($row =mysqli_fetch_assoc($res)

需要是

while($row =mysqli_fetch_assoc($res))


查看完整回答
反對 回復 2023-09-08
  • 1 回答
  • 0 關注
  • 76 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號