모든 레코드를 데이터베이스에서 가져 오는 데 시간이 있습니다. 예를 들어 나는mysql/PHP 코드가 처음과 마지막을 제외한 모든 행을 반환합니다.
$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 개의 레코드 만 있습니다.
나는 바보 같은 것을 놓치고있다. 나는 그것을 안다. 나는 질문을보고 답을 찾을 수 없었다. 감사합니다
, 당신은 우리를 위해 당신의 DB를 붙여 넣을 수 있습니다 :
이 코드해야 하는가? – DaOgre
그 Norse, 똑같은 것이있다 : ( – ATechGuy
Keaner가 무슨 뜻인지 잘 모르겠다. $ count = mysql_num_rows ($ result);에 추가해 보라; count는 $ count이다; "'루핑을하기 전에 mysql이 기대하는 행 수를 확보하고 있는지 확인하십시오. 위의 코드를 사용하여 전체 코드로 업데이트 할 수 있다면 ("SELECT * from plant_info"덤프와 마찬가지로) 사람들이 도와 줘요 – DaOgre