Amita Singh
asked on
while loop in html mail format
i want my record in loop but when i use while loop it fetch 5 records but in my db 6 records. and i want number in list (like 1 ,2...) when i use $i= 1; and $i++ code show error. i don't fine where i wrong.
$i =1;
while($invoicedata = mysql_fetch_array($invoicesql)){
echo "<pre>";
print_r($invoicedata);
$htmlContent .= '<tr>
<td style="border: 1px solid #ccc; line-height: 22px; padding: 2px; width: 20%;">1</td>
<td style="text-align:center; border: 1px solid #ccc; line-height: 22px; padding: 2px; width: 60%;" >'.$invoicedata['item_name'].'</td>
<td style="border: 1px solid #ccc; line-height: 22px; padding: 2px; width: 20%;text-align:right;">'.$invoicedata['item_price'].'</td>
</tr>';
$i++;
}
ASKER
Thanx for Reply,
its not work. my code is.
its not work. my code is.
$i =1;
while($invoicedata = mysql_fetch_array($invoicesql)){
$htmlContent .= '<tr>
<td style="border: 1px solid #ccc; line-height: 22px; padding: 2px; width: 20%;">1</td>
<td style="text-align:center; border: 1px solid #ccc; line-height: 22px; padding: 2px; width: 60%;" >'.$invoicedata['item_name'].'</td>
<td style="border: 1px solid #ccc; line-height: 22px; padding: 2px; width: 20%;text-align:right;">'.$invoicedata['item_price'].'</td>
</tr>';
$i++;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you Stefan,
i found my error. its work now perfect.
i found my error. its work now perfect.
ASKER
Thank you both of you for helping me.
$i =1;
while($invoicedata = mysql_fetch_array($invoice
echo "<pre>";
echo "<tr><td>".($pre['item_nam
}
print_r($invoicedata);
$htmlContent .= '<tr>
<td style="border: 1px solid #ccc; line-height: 22px; padding: 2px; width: 20%;">1</td>
<td style="text-align:center; border: 1px solid #ccc; line-height: 22px; padding: 2px; width: 60%;" >'.$invoicedata['item_name
<td style="border: 1px solid #ccc; line-height: 22px; padding: 2px; width: 20%;text-align:right;">'.$
</tr>';
$i++;
}