我有一张这样的表:
我想选择具有相同代码的行,并在我的页面中通过php显示它们,例如代码333306b4af587:
怎么做?
答案 0 :(得分:0)
使用可以使用此 你会有
SELECT row FROM table WHERE value1= value2;
如果你想配对两个相同的值
SELECT row FROM Qustion1, Question2 WHERE value1 <> value2 AND value1 = value2
答案 1 :(得分:0)
<?php
include 'db_inc.php';
$code=mysqli_query($dbCnn,"select distinct uniqid,questionid from answers") or die(mysqli_error($dbCnn));
echo "<table border='1'> ";
while($row=mysqli_fetch_array($code)){
$result=mysqli_query($dbCnn,"select * from answers where uniqid='$row[uniqid]' and formid=$form" )or die(mysqli_error($dbCnn));
echo "<tr>";
while ($responses=mysqli_fetch_array($result)){
echo "<td>$responses[answer]</td>";
}
echo "</tr>";
}
echo "</table>";