我目前正在使用一个表格,使用<条码>how栏条码>,以便把所有栏目纳入核对箱。 下面的法典就是这样做的。 我试图在问询中设定另一个查询权,以寻找一个有相同栏目的不同表格,如果表中的行文有0或1个显示“检查”箱。 之所以使用“单列”查询,是因为各项目总是增加一栏。
/////EDIT after posting I realized that it will be better just to use the same table since the "Columns" represent all the "checkboxes" when output anyway. But the same problem still exists. I am trying to double up on the queries. Query 1 = Extract all columns and create checkboxes Query 2 = use row that matches $newloc and if checkboxes are in specific columns mark out put columns with "Checked" boxes. I have another query on the same page that populated user information which works fine. This page works as a confirmation page which has all user information as well as certain items they have (the Checkboxes) and then they can edit on this page and submit if needed. I want to be clear on all that is in this page just in case that effects this part. One other thing I need to add is since I am using the same table I need to skip the first 3 columns since that is other data that I dont want as columns.
<?php
$conc = new mysqli("127.0.0.1:3306", "root", "", "mydb");
$res= $conc ->query("SHOW COLUMNS from matmemmatrix");
// this part here is what I was imagining would work
$sql = "SELECT * FROM matmemmatrix WHERE memid1 = $uid AND memlocid = $newloc ";
$datam = mysqli_query($conc, $sql);
$a = 1;
$row1 = $datam[$a]; // first column ??
//
echo "<html>";
echo "<body>";
echo "<table>";
$i = 0;
while ($row = $res->fetch_assoc()) {
$id = $row[ Field ];
// EDIT : check to see if $id matches $row1
if($id = $row1){
$checked = 1;
}else{
$checked = 0;
}
//
if($i > 5 ){
$i== 0 ;
if($i== 5 ){
echo "</tr>";
echo "<tr>";
$i = 0 ;
;
if ($i == 0 ){
echo "<tr>";
};
echo "<td>";
echo <input type ="checkbox"
value=" .htmlspecialchars($id). "
id=" .htmlspecialchars($id). "
name=" .htmlspecialchars( mat[] ). "
checked= .$checked. >
</option> ;
echo <label for =" .htmlspecialchars($id). "> .htmlspecialchars($id). </label> ;
echo "</td>";
$i++;
// EDIT Increment next column to see if 0 or 1
$a++;
//
}
echo "</table>";
echo "</body>";
echo "</html>";
?>
我试图利用下文中的询问,以获得“检查”栏。 但失败。
$sql = "SELECT * FROM matmemmatrix WHERE memid1 = $uid && memlocid = $newloc ";
I couldn t get any results from that query to work with the above query.
我试图利用上述询问本身,提取所有栏目作为检查箱使用,并使用1或0的浏览数据作为检查但失败的标志。
能否从这个栏目中提取一栏作为检查箱,并利用浏览数据显示,如果1或0,将进行核对? 我想确保表格中的所有栏目都表明它们是否受到检查。