asked on
This statement is not returning results to my index.php page. In fact the page will not even open. order.php
<?php
namespace Phppot;
use Phppot\DataSource;
class Order
{
private $ds;
function __construct()
{
require_once __DIR__ . '../lib/DataSource.php';
$this->ds = new DataSource();
}
function getAllOrders()
{
$query = "SELECT * FROM tbl_session";
$result = $this->ds->select($query);
return $result;
}
function getPdfGenerateValues($id)
{
//$query = "SELECT * FROM tbl_session WHERE therapist_id='" . $id . "'";
$query = "SELECT * FROM tbl_session WHERE therapist_id=1";
$result = $this->ds->select($query);
return $result;
}
function getOrderItems($session_id)
{
$sql = "SELECT
tbl_session.session_id,
tbl_session.session_date,
tbl_session.session_type,
tbl_session.session_status,
tbl_therapist.therapist_name,
tbl_therapist.therapist_street,
tbl_therapist.therapist_city,
tbl_therapist.therapist_state,
tbl_therapist.therapist_zip_code,
tbl_therapist.therapist_indy_fee,
tbl_therapist.therapist_couple_fee,
tbl_therapist.therapist_group_fee,
tbl_client.client_name
FROM
tbl_session
INNER JOIN
tbl_therapist
ON
tbl_session.therapist_id = tbl_therapist.therapist_id
INNER JOIN
tbl_client
ON
tbl_session.client_id = tbl_client.client_id
WHERE
tbl_session.session_status = Completed";
}
}
ASKER
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
Notice: Undefined variable: orderResult in /home/audiodigz/public_html/INVOICE/index.php on line 29<?php foreach ($orderResult as $k => $v) { ?>
<tr>
<td><?php echo $orderResult[$k]["session_id"];?></td>
<td class="text-right"><?php echo $orderResult[$k]["session_date"];?></td>
<td class="text-right"><?php echo $orderResult[$k]["client_name"];?></td>
<td class="text-right"><a target="_blank"
title="Generate Invoice"
href="invoice.php?id=<?php echo $orderResult[$k]["session_id"];?>"><?php echo $orderResult[$k]["session_id"];?></a></td>
</tr>
<?php }?>
This line for starters...$orderResult = $orderModel->getAllOrders();
<?php
class Order
{
function getAllOrders()
{
return "this is all the orders";
}
}
$orderModel = new Order;
$orderResult = $orderModel->getAllOrders();
echo $orderResult;
$orderResult = $orderModel->getAllOrders();
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY
1) Uncomment error_reporting(-1);
2) Visit page.
3) Refer to either your Apache error.log file or PHP error.log file which will show you the exact file name + line number raising the Fatal, which produces the 500 Internal error.