Ardameh
سه شنبه 17 مرداد 1391, 19:07 عصر
سلام به همه دوستان
میخواستم بدونم اگر بخوام یک mysql_query رو در صفحه چند بار تکرار کنم؛ چطور این کار انجام میشه؟
الان من اینطوری اینکار رو کردم ولی فقط اولیش چواب میده :
<div style="width:20px; height:20px; color:#F30; text-align:center; margin-left:170px; margin-top:170px; position: absolute;">
<?php
$result = mysql_query("SELECT * FROM projects WHERE mm_fa='1'");
while($row = mysql_fetch_array($result)) { $count1 ++; } echo $count1; ?>
</div>
<div style="width:20px; height:20px; color:#F30; text-align:center; margin-left:350px; margin-top:170px; position: absolute;">
<?php
$result = mysql_query("SELECT * FROM projects WHERE mm_fa='2'");
while($row = mysql_fetch_array($result)) { $count2 ++; } echo $count2; ?>
</div>
<div style="width:20px; height:20px; color:#F30; text-align:center; margin-left:530px; margin-top:170px; position: absolute;">
<?php
$result = mysql_query("SELECT * FROM projects WHERE mm_fa='3'");
while($row = mysql_fetch_array($result)) { $count3 ++; } echo $count3; ?>
</div>
<div style="width:20px; height:20px; color:#F30; text-align:center; margin-left:710px; margin-top:170px; position: absolute;">
<?php
$result = mysql_query("SELECT * FROM projects WHERE mm_fa='4'");
while($row = mysql_fetch_array($result)) { $count4 ++; } echo $count4; mysql_close($con);?>
</div>
<img name="" src="images/m-back.png" width="800" height="600" alt="" />
</div>
میخواستم بدونم اگر بخوام یک mysql_query رو در صفحه چند بار تکرار کنم؛ چطور این کار انجام میشه؟
الان من اینطوری اینکار رو کردم ولی فقط اولیش چواب میده :
<div style="width:20px; height:20px; color:#F30; text-align:center; margin-left:170px; margin-top:170px; position: absolute;">
<?php
$result = mysql_query("SELECT * FROM projects WHERE mm_fa='1'");
while($row = mysql_fetch_array($result)) { $count1 ++; } echo $count1; ?>
</div>
<div style="width:20px; height:20px; color:#F30; text-align:center; margin-left:350px; margin-top:170px; position: absolute;">
<?php
$result = mysql_query("SELECT * FROM projects WHERE mm_fa='2'");
while($row = mysql_fetch_array($result)) { $count2 ++; } echo $count2; ?>
</div>
<div style="width:20px; height:20px; color:#F30; text-align:center; margin-left:530px; margin-top:170px; position: absolute;">
<?php
$result = mysql_query("SELECT * FROM projects WHERE mm_fa='3'");
while($row = mysql_fetch_array($result)) { $count3 ++; } echo $count3; ?>
</div>
<div style="width:20px; height:20px; color:#F30; text-align:center; margin-left:710px; margin-top:170px; position: absolute;">
<?php
$result = mysql_query("SELECT * FROM projects WHERE mm_fa='4'");
while($row = mysql_fetch_array($result)) { $count4 ++; } echo $count4; mysql_close($con);?>
</div>
<img name="" src="images/m-back.png" width="800" height="600" alt="" />
</div>