bluemix 500错误简单查询

时间:2015-12-24 11:58:49

标签: php mysql ibm-cloud

我正在尝试进行简单查询以从我的数据库中获取信息。当我启动浏览器时,我收到错误代码500.我不明白为什么。我正在使用bluemix devOps。这是我的代码:

<?php include 'db.php';?>

<?php

//Query to get information from the database
$strsql = "SELECT name, technology, problem FROM idea WHERE status='saved'";
if ($result = $mysqli->query($strsql)) {

} else {

        echo "<b>Can't query the database;
    }

?>


      <?php
                    echo "<tr>\n";
                    while ($property = mysqli_fetch_field($result)) {
                            echo '<th>' .  $property->name . "</th>\n"; //the headings


                    }
                    echo "</tr>\n";

                    mysqli_data_seek ( $result, 0 );
                    if($result->num_rows == 0){ //nothing in the table
                                echo '<td>Empty!</td>';
                    }

                    while ( $row = mysqli_fetch_row ( $result ) ) {
                        echo "<tr>\n";
                        for($i = 0; $i < mysqli_num_fields ( $result ); $i ++) {
                            echo '<td>' . "$row[$i]" . '</td>';
                        }
                        echo "</tr>\n";
                    }

                    $result->close();
                    mysqli_close();
                ?>

1 个答案:

答案 0 :(得分:0)

您的代码中有错误

echo "<b>Can't query the database; 

缺少关闭的doblue报价