Jump to content

php receipt creation


i_love_php_not

Recommended Posts

Hello, I am trying to create a receipt to display on my web page. The receipt is layed out in 2 sections - one with a ReceiptHead (this comprises of ReceiptNo, Date, TotalPrice) and another with ReceiptLine (this includes repeating data i.e barcode, itemprice, quantity). Right now I can only return the first row, using an array, and would like to know how to create a line for each record.

 

:)

Link to comment
https://forums.phpfreaks.com/topic/47877-php-receipt-creation/
Share on other sites

not too sure how much to post but ive took out the connection string and all before the php tag.

  <?php

 

$receiptno = $_POST['receiptno'];

 

$query = "SELECT R.ReceiptNo, R.DateOfPurchase, R.Total_Value, R.StaffNo, RI.Quantity, P.BarCode, P.Price FROM Receipt R, ReceiptItem RI, Product P

  WHERE R.ReceiptNo = RI.ReceiptNo

  AND RI.BarCode = P.BarCode

  AND R.ReceiptNo = $receiptno";

 

$stmt = ociparse($conn,$query);

 

ociexecute($stmt);

 

while (ocifetchinto($stmt, $row))

{

 

}

 

?>

</p>

<table width="445" border="1" align="center">

  <tr>

    <td width="132" valign="bottom"><div align="center"><strong><font face="Arial, Helvetica, sans-serif">Receipt Number </font></strong></div></td>

    <td width="97" valign="bottom"><div align="center"><strong><font face="Arial, Helvetica, sans-serif">Date</font></strong></div></td>

    <td width="53" valign="bottom"><div align="center"><strong><font face="Arial, Helvetica, sans-serif">Total</font></strong></div></td>

    <td width="135" valign="bottom"><div align="center"><strong><font face="Arial, Helvetica, sans-serif">Staff Number </font></strong></div></td>

  </tr>

  <tr>

    <td><div align="center"><?php print $row[0]; ?></div></td>

    <td><div align="center"><?php print $row[1]; ?></div></td>

    <td><div align="center"><?php print $row[2]; ?></div></td>

    <td><div align="center"><?php print $row[3]; ?></div></td>

  </tr>

</table>

<p> </p>

<table width="807" border="1" align="center">

  <tr>

    <td width="66" valign="bottom"><div align="center"><strong><font face="Arial, Helvetica, sans-serif">Quantity</font></strong></div></td>

    <td width="167" valign="bottom"><div align="center"><strong><font face="Arial, Helvetica, sans-serif">Barcode</font></strong></div></td>

    <td width="111" valign="bottom"><div align="center"><strong><font face="Arial, Helvetica, sans-serif">Item Price</font></strong></div></td>

  </tr>

  <tr>

    <td><div align="center"><?php print $row[4]; ?></div></td>

    <td><div align="center"><?php print $row[5]; ?></div></td>

    <td><div align="center"><?php print $row[6]; ?></div></td>

  </tr>

</table>

<p align="center"> </p>

<div align="center">

  <form action="receipt.php" method="post"/>

 

 

Link to comment
https://forums.phpfreaks.com/topic/47877-php-receipt-creation/#findComment-233961
Share on other sites

Example

----------

<?php

$conn = ocilogon("username", "password");

 

$query = "SELECT apples FROM oranges";

 

$statement = OCIParse ($conn, $query);

OCIExecute ($statement);

echo "<table>";

while (OCIFetchInto ($statement, $row, OCI_ASSOC)) {

    echo "<tr><td>".$row['apples']."</tr></td>";

}

echo "</table>";?>

Link to comment
https://forums.phpfreaks.com/topic/47877-php-receipt-creation/#findComment-233970
Share on other sites

have modified the statement slightly

 

echo "<tr><td>".$row['R.ReceiptNo, R.DateOfPurchase, R.Total_Value, R.StaffNo, RI.Quantity, P.BarCode, P.Price']."</tr></td>";

 

got this error message!!

 

Warning: ociexecute(): OCIStmtExecute: ORA-00921: unexpected end of SQL command in /homedir/ilex-s01/aarmstr2/public_html/receipt.php on line 40

 

Warning: ocifetchinto(): OCIFetchInto: ORA-24374: define not done before fetch or execute and fetch in /homedir/ilex-s01/aarmstr2/public_html/receipt.php on line 44

Link to comment
https://forums.phpfreaks.com/topic/47877-php-receipt-creation/#findComment-233993
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.