我有一个 php 脚本来运行 mssql 查询。当我运行“SELECT first_name, last_name, mi FROM users”之类的查询时,我得到的只是“first_name”。这是脚本:
<?php
require '../../scripts/database_connection.php';
$query_text = $_REQUEST['query'];
$result = mssql_query($query_text);
if (!result) {
die("<p>Error: " . $query_text ."</p>");
}
$return_rows = true;
if (preg_match("/^\s*(CREATE|INSERT|UPDATE|DELETE|DROP)/i,
trim(strtoupper($query_text)))) {
$return_rows = false;
}
if ($return_rows) {
echo "<p>Results from your query:</p>";
echo "<ul>";
while ($row = mssql_fetch_row($result)) {
echo "<li>{$row[0]}</li>";
}
echo "</ul>";
}
else {
if ($result) {
echo "<p>Your query was processed successfully.</p>";
echo "<p>$query_text</p>";
}
}
?>
有什么建议么?