gpt4 book ai didi

PHP mysql 查询返回空白屏幕

转载 作者:行者123 更新时间:2023-11-29 12:46:00 24 4
gpt4 key购买 nike

我已经注释掉了底部部分,并且 SQL 查询工作正常。我相信它显示了错误来自的查询。

$host = "127.0.0.1"; 
$user = "root";
$pass = "Toom13371!";

$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");

// 2. Selecting DB.

$dbname = "filters";
mysql_select_db($dbname);

// 3. Build/Test SQL Query

$sql = ("select * from filter_bandpass where start_passband=" . $_POST['Lowfreq'] . " and stop_passband='" . $_POST['Highfreq'] . "'");
//echo $sql; //Comment/Uncomment to test sql query.

// 4. Retrieve info from MySQL.

$query = mysql_query($sql);

// 5. Display Query.

echo "<table border='1'>
<tr>
<th>Low Frequency</th>
<th>High Frequency</th>
</tr>";

while($row = mysql_fetch_array($query)) {
echo "<tr>";
echo "<td>" . $row['Lowfreq'] . "</td>";
echo "<td>" . $row['Highfreq'] . "</td>";
echo "</tr>";
}

echo "</table>";
?>

任何帮助将不胜感激,我确信这将是我忽略的一些小愚蠢错误。

提前致谢:)

最佳答案

根据您的查询,我猜测您需要更改此设置

mysql_select_db($dbname);

mysql_select_db($dbname, $connection);

while($row = mysql_fetch_array($query)) {
echo "<tr>";
echo "<td>" . $row['Lowfreq'] . "</td>";
echo "<td>" . $row['Highfreq'] . "</td>";
echo "</tr>";
}

while($row = mysql_fetch_array($query)) {
echo "<tr>";
echo "<td>" . $row['start_passband'] . "</td>";
echo "<td>" . $row['stop_passband'] . "</td>";
echo "</tr>";
}

关于PHP mysql 查询返回空白屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25423623/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com