<?php
$sqls = mysql_query("SELECT weight FROM $usertablestats")
or die ("Query failed: " . mysql_error() . " Actual query: " . $query);
$ct = mysql_query ("COUNT * '$sqls'");
if ($ct > 0) {
while ($row = mysql_fetch_array($sqls));{
$weight = $row["weight"];
echo "C" . $weight;
}}
else {
echo "No stats found";
}
?>
即使表中有數據,也會輸出「No stats found」。我的PHP MySQL While while循環不返回結果
<?php
$sqls = mysql_query("SELECT weight FROM $usertablestats")
or die ("Query failed: " . mysql_error() . " Actual query: " . $query);
$ct = mysql_num_rows($sqls);
if ($ct > 0) {
while ($row = mysql_fetch_array($sqls));{
$weight = $row["weight"];
echo "C" . $weight;
}}
else {
echo "No stats found";
}
?>
這不會返回任何內容。根本沒有迴音。
我檢查,看它是否是通過只使用訪問:
<?php
$sqls = mysql_query("SELECT weight FROM $usertablestats")
or die ("Query failed: " . mysql_error() . " Actual query: " . $query);
$row = mysql_fetch_array($sqls);
echo $row;
?>
而且它返回的第一個條目。
//謝謝!我是新來的,我知道這一定是我的一些愚蠢的東西。它效果很好。我不認爲有辦法從第一行中減去最後一行? –