我有时间尝试从数据库中提取所有记录。例如我有以下
$result = mysql_query("SELECT * FROM `plant_info` ORDER BY id LIMIT 0, 50") or die(mysql_error());
// Variables to pull from the database
// I know the line below is the culprit now, so i must change the code below correct? ///
$returneddata = mysql_fetch_array($result);
///////////////////////////////////////////
$LatinName = $returneddata['Latin_Name'];
$CommonName = $returneddata['Common_Name'];
$Category = $returneddata['Category'];
$Type = $returneddata['Type'];
$Fruit = $returneddata['Fruit'];
$Flower = $returneddata['Flower'];
$MinHeight = $returneddata['Min_Height'];
$MaxHeight = $returneddata['Max_Height'];
$MinWidth = $returneddata['Min_Width'];
$MaxWidth = $returneddata['Max_Width'];
$Exposure = $returneddata['Exposure'];
$Comments = $returneddata['Comments'];
$SoilType = $returneddata['Soil_Type'];
$Zone = $returneddata['Zone'];
$PotSize = $returneddata['Pot_Size'];
$CostPrice = $returneddata['Cost_Price'];
$RetailPrice = $returneddata['Retail_Price'];
$ImageName = $returneddata['Image_Name'];
$ImageNameThumb = $returneddata['Image_Name_Thumb'];
$num_rows = mysql_num_rows($result); echo "$num_rows Rows\n";
while ($row = mysql_fetch_array($result)) {
echo " <tr>
<td align=\"center\" bgcolor=\"#000000\">
<p><img src=\"$row[Image_Name]\" style=\"width:120px;height:auto;\"></p>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Latin_Name]</p>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Common_Name]</p>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Category]</p>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Type]</p>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Flower]</p>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p>$row[Comments]</p>
</td>
</td>
<td align=\"center\" bgcolor=\"#90c084\">
<p><a href=\"editplant.php?get=$row[id]\">Edit</a></p>
<p><a href =\"print_sign_div.php?get=$row[id]\">Print</a></p>
</td>
</tr>
";
}
我遇到的问题是它会提取除第一个之外的所有记录。其他记录显示,目前只有 5 条记录。
我错过了一些我知道的愚蠢的东西。我浏览了问题,但找不到答案。谢谢