PDA

View Full Version : شماره ردیف دادن به رکورد های دیتابیس زمان پرینت



arashaliz
یک شنبه 24 آذر 1392, 11:41 صبح
با سلام

چه طوری می شه زمانی که رکورد هارو می خوایم پرینت کنیم یک شماره ردیف هم بهشون بدیم
من که هر کاری می کنم شماره درست نمیده
این کدیه که من استفاده می کنم


while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table

$wId =$row['wId'];
$wNo =$row['wNo'];
$wDesc =$row['wDesc'];

$wDesc_new = substr($wDesc,0,30);

echo "<div>ردیف شماره</div><div><a href=\"detail.php?Url=$wId\">" . '...' . $wNo . ' - ' . $wDesc_new . " </a> </div>\n";

MMSHFE
یک شنبه 24 آذر 1392, 12:40 عصر
$id = 1;
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
$wId = $row['wId'];
$wNo = $id++;
$wDesc = $row['wDesc'];
$wDesc_new = substr($wDesc,0,30);
echo "<div>ردیف شماره</div><div><a href=\"detail.php?Url=$wId\">" . '...' . $wNo . ' - ' . $wDesc_new . " </a> </div>\n";
}

sh.n.n786
یک شنبه 24 آذر 1392, 12:52 عصر
$num = 0;
while($row = mysql_fetch_array($result)) {
$num++;
echo "<div>{$num}</div><div>.......</div>" . PHP_EOL;
}

arashaliz
یک شنبه 24 آذر 1392, 12:52 عصر
اقا دست شما درد نکنه
چقدر ساده بود
واقعا ممنون