<?=$qty;?> into $qty1, $qty2, qty3
: pt paź 09, 2009 8:38 am
witam,
mam maly problem. pobieram dane z tabeli mysql, wyswietlam je na stronce, a potem przesylam zmienne [te juz pobrane i wyswietlone] do nastepnego skryptu. Wszystko jest ok dopoki jest jeden produkt z jedna cena, ale gdy wrzuce na invoice wiecej itemow do skryptu dalej przesylana jest tylko ostatnia wartosc. jaki jest najlepsze sposob na sciagniecie tych zmiennych i przypisanie ich do roznych zmiennych? tak, zebym np. z <?=$qty;?> w przypadku 3 rowkow mial $qty1, $qty2, qty3... sorki, ale jestem poczatkujacy a trafila mi sie robota do robienia invoice, please help ;D
<?
$q = mysql_query("select * from invoice where invoice_id = '$_REQUEST[invoice_id]'") or die(mysql_error());
$row = mysql_fetch_array($q);
extract($row);
$q1 = mysql_query("select * from invoice_details where invoice_id = '$invoice_id'") or die(mysql_error());
$itemnum = mysql_num_rows($q1);
?>
to jest na gorze...
a potem tak
<tr>
<td colspan="4"><table width="100%" border="0" cellpadding="5" cellspacing="0" class="tablebod">
<tr>
<td width="12%" align="center" bgcolor="#DFEDF9"><strong>Quantity</strong></td>
<td width="36%" align="center" bgcolor="#DFEDF9"><strong>Description</strong></td>
<td width="13%" align="center" bgcolor="#DFEDF9"><strong>Unit Price</strong></td>
<td width="20%" align="center" bgcolor="#DFEDF9"><strong>Vat Amount </strong></td>
<td width="19%" align="center" bgcolor="#DFEDF9"><strong>Total Price</strong> </td>
</tr>
<?
$i=1;
while($row1 = mysql_fetch_array($q1))
{
extract($row1);
?>
<tr>
<td align="center" valign="top" class="bod-right"><?=$qty;?> </td>
<td align="center" valign="top" class="bod-right"><?=$itemdescription;?></td>
<td align="center" valign="top" class="bod-right">£<?=$amount;?></td>
<td align="center" valign="top" class="bod-right"><?=$vat;?>%</td>
<td align="center" valign="top">£<?=$pricetotal;?></td>
</tr>
<?
$i++;
}
?>
mam maly problem. pobieram dane z tabeli mysql, wyswietlam je na stronce, a potem przesylam zmienne [te juz pobrane i wyswietlone] do nastepnego skryptu. Wszystko jest ok dopoki jest jeden produkt z jedna cena, ale gdy wrzuce na invoice wiecej itemow do skryptu dalej przesylana jest tylko ostatnia wartosc. jaki jest najlepsze sposob na sciagniecie tych zmiennych i przypisanie ich do roznych zmiennych? tak, zebym np. z <?=$qty;?> w przypadku 3 rowkow mial $qty1, $qty2, qty3... sorki, ale jestem poczatkujacy a trafila mi sie robota do robienia invoice, please help ;D
<?
$q = mysql_query("select * from invoice where invoice_id = '$_REQUEST[invoice_id]'") or die(mysql_error());
$row = mysql_fetch_array($q);
extract($row);
$q1 = mysql_query("select * from invoice_details where invoice_id = '$invoice_id'") or die(mysql_error());
$itemnum = mysql_num_rows($q1);
?>
to jest na gorze...
a potem tak
<tr>
<td colspan="4"><table width="100%" border="0" cellpadding="5" cellspacing="0" class="tablebod">
<tr>
<td width="12%" align="center" bgcolor="#DFEDF9"><strong>Quantity</strong></td>
<td width="36%" align="center" bgcolor="#DFEDF9"><strong>Description</strong></td>
<td width="13%" align="center" bgcolor="#DFEDF9"><strong>Unit Price</strong></td>
<td width="20%" align="center" bgcolor="#DFEDF9"><strong>Vat Amount </strong></td>
<td width="19%" align="center" bgcolor="#DFEDF9"><strong>Total Price</strong> </td>
</tr>
<?
$i=1;
while($row1 = mysql_fetch_array($q1))
{
extract($row1);
?>
<tr>
<td align="center" valign="top" class="bod-right"><?=$qty;?> </td>
<td align="center" valign="top" class="bod-right"><?=$itemdescription;?></td>
<td align="center" valign="top" class="bod-right">£<?=$amount;?></td>
<td align="center" valign="top" class="bod-right"><?=$vat;?>%</td>
<td align="center" valign="top">£<?=$pricetotal;?></td>
</tr>
<?
$i++;
}
?>