douzhuang6321 2015-12-01 17:07
浏览 8

从已选中的复选框激活查询

I have a basic form with just 1 text area and a submit button. Once submitted, it sends the name entered into a MySQL table.

The table structure is; ID , name , score,

The ID is AI. The name is user input and the score has a default of 0.

Then, I have an output page, which is where I need the help. On the output page, I have made my connection checked my connection caught my ASSOC's array and dropped it into a little HTML table to keep it organised, and I have added a checkbox to the end of each row.

Now, what I'm trying to do is: when any of the checkboxes are checked, I need a query to run to add 1 to the current value of score in the record.

Here is my code so far and YES it is very basic so far and it does work. I know I have to add some security to it and a lot of formatting but those can happen once I get the project working....

Here is my code:

<html>
<head>
    <title> DaTaBaSe CoNeCtIoN TeStInG PaGe </title>
</head>
<body bgcolor="000000">
<font color="FF0000">

<?php
include ('conection.php');



//define $result as $con and run the query $sql 
$result = $conn->query($sql);
//if number of rows in the table is higher 0 draw the table 
if ($result->num_rows > 0) {
echo 
"<table border= 5 bordercolor= #0000FF><tr><th><font       color=#FF0000>ID</th><th><font color=#FF0000>Name</th></tr>";
//output the data
  while($row = $result ->fetch_assoc()) {
      //add the results to populate the table 
      echo "<tr><td><font color= #FF0000>".$row  [id]."</td><td><font color= #FF0000>".$row["name"]."</td><td><font color= #FF0000>".$row["score"]."</td><td><input type= checkbox name=win>".$row["win"]."</td></tr>";
      }
echo "</table>";
} else {
echo "0 results found";
}

 $conn->close();
 ?>

</font>
</body>
 </html>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度
    • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测