我正在尝试将变量从页面传递到另一个页面,以便我可以通过获取想法在另一页面上显示更多信息。我不确定出了什么问题,因为我使用bluemix它没有显示错误它只是给我500页错误。这是我的代码:
<?php
$strsql = "select id, name, problem, urgency, technology from idea WHERE status='saved'";
if ($result = $mysqli->query($strsql)) {
// printf("<br>Select returned %d rows.\n", $result->num_rows);
} else {
//Could be many reasons, but most likely the table isn't created yet. init.php will create the table.
echo "<b>Can't query the database, did you <a href = init.php>Create the table</a> yet?</b>";
}
?>
<?php
echo "<tr>\n";
while ($property = mysqli_fetch_field($result)) {
echo '<th>' . $property->name . "</th>\n"; //the headings
}
echo "</tr>\n";
while ( $row = mysqli_fetch_row ( $result ) ) {
$idea_id= $row['id'];
echo "<tr>\n";
for($i = 0; $i < mysqli_num_fields ( $result ); $i ++) {
echo <a href ="meerinfo.php?idea= '. $idea_id .'"> '<td>' . "$row[$i]" . '</td>'</a>;
}
echo "</tr>\n";
}
$result->close();
mysqli_close();
?>
答案 0 :(得分:1)
您的代码中存在一个小错误。您的echo <a href ="...
行应该是这样的,
echo '<td><a href ="meerinfo.php?idea='. $idea_id .'">' . $row[$i] . '</a></td>';