我正在尝试通过ID传递a href。它一直给我这个奇怪的错误,尽管我以前做过很多次。错误是:
错误:SQLSTATE[42S22]:找不到列:1054未知列“rowid”
在“where子句”中
这是我在href中用于id的行:
<?php
$link = mysql_connect("localhost", "root", "");
mysql_select_db("meubelfabriek");
$result = mysql_query("SELECT * FROM inbox") or
die(mysql_error());
while($rowz = mysql_fetch_array($result)) {
$id = $rowz['id'];
?>
<td>
<li class="list-group-item text-right"><a class="pull-left" href="login/email.php?id=rowid=<?= $rowz['id'] ?>"> <?php echo '<h7>' . $rowz['email'] . '</a> 2.13.2014</li>
</td>
电子邮件php
<?php
echo "<table style='border: solid 1px black;'>";
echo "<tr><th>Id</th><th>Firstname</th><th>Lastname</th></tr>";
class TableRows extends RecursiveIteratorIterator {
function __construct($it) {
parent::__construct($it, self::LEAVES_ONLY);
}
function current() {
return "<td style='width:150px;border:1px solid black;'>" . parent::current(). "</td>";
}
function beginChildren() {
echo "<tr>";
}
function endChildren() {
echo "</tr>" . "\n";
}
}
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "meubelfabriek";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$id = $_GET['id'];
$stmt = $conn->prepare("SELECT id, voornaam, achternaam, email, nummer, bericht FROM inbox WHERE id = $id");
$stmt->execute();
// set the resulting array to associative
$result = $stmt->setFetchMode(PDO::FETCH_ASSOC);
foreach(new TableRows(new RecursiveArrayIterator($stmt->fetchAll())) as $k=>$v) {
echo $v;
}
}
catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
$conn = null;
echo "</table>";
?>
在我的数据库中,ID只是由ID定义的。所有prepare语句都写得很好。有人知道我为什么不能让它工作吗?在过去,它似乎工作得很好。无论如何,我希望任何人都能帮助我。