将变量传递到另一个页面以进行 sql 查询

passing variable to another page for sql query

我正在尝试将一个变量从一个页面传递到另一个页面,这样我就可以通过获取想法在另一个页面上显示更多信息。我不太确定出了什么问题,因为我使用 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();
                    ?>

您的代码中有一个小错误。你的 echo <a href ="... 行应该是这样的,

echo '<td><a href ="meerinfo.php?idea='. $idea_id .'">' . $row[$i] . '</a></td>';