Code:
<?php
include('core/settings.php');
include('core/connection.php');
function getInvoice($n, $conn)
{
$stid = oci_parse($conn, '
SELECT InvoiceNo FROM Orders WHERE OrderNo = $n
');
oci_execute($stid);
$result = oci_fetch_array($stid, OCI_BOTH);
echo $result;
}
getInvoice(1050505);
?>
I am not shown the results of getInvoice
when visiting this page. The manual SQL works ok. Is there a problem here in the PHP that I am using?
Edit 1: If there is a simpler method to do this then please suggest it. The SQL result is a simple number for example:
InvoiceNo
---------
1050505
Edit 2: I have updated functions.php
and put it below.
<?php
function getInvoice($n)
{
include('connection.php');
$stid = oci_parse($conn, 'SELECT InvoiceNo FROM Orders WHERE OrderNo = '.$n);
oci_execute($stid);
$row = oci_fetch_array($stid, OCI_BOTH);
echo $row['0'];
}
?>
The getInvoice
works if I use it within that file, but when I try and use this in another file, it doesn't return anything.
<? php
include('core/functions.php');
getInvoice(1050505);
?>