Hi
I need to know, is there any option to use For loop instead of While and ForEach to retrieve the result.
While Loop
-----------
$query = "SELECT name, subject, message FROM contact";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "Name :{$row['name']} <br>" .
}
instead to this , i need For Loop not For Each.
For Loop [Something like this]
--------
$stylequery="SELECT DoorID, DoorType
FROM do_style
WHERE DiyOrderID = '$orderId'" ;
$styleresult= mysql_query($stylequery,$con)
$row = $styleresult;
for($sloop = 0; $sloop < 2; $sloop++)
{
echo("<tr>
<td style='width: 49px; height: 24px; text-align: center' title='Wall Cabinets'>
$sloop
</td>
<td style='width: 61px; height: 24px'>$row[$sloop]['DoorType']
</td>
</tr>
"
)
}
Bcoz, I need to loop number of times and echo the html statements to get aligned the page layout even data are not there.
Thanks in Advance