This topic is locked
[SOLVED]

help on formatting code snippet result

12/23/2022 4:27:06 PM
PHPRunner General questions
francesco author

Hi all, I have a code snippet that looks like something like that:

$rsOrders = $tblOrders->Query("customerid='".$CustomerID."'","");
while($data=db_fetch_array($rsOrders))
{
echo "".
$data["OrderID"]." ".$data["OrderDate"]."
";

If I have several lines to be displayed, how can I modify the code to have different lines:
OrderID 1 Orderdate 2
OrderID 2 Orderdate 2

thanks for the help

Sergey Kornilov admin 12/23/2022

It will help if you post the whole code snippet, it looks truncated. It will also help if you show us the current output produced by this code snippet.

francesco author 12/24/2022

the code is taken from https://xlinesoft.com/blog/2011/04/28/taming-the-beast-events-buttons-and-code-snippets/, similar to mine:

global $dal;
$tblOrders = $dal->Table("Orders");
$rs = $tblOrders->Query("OrderID=".$_REQUEST["edtidi1"],"");
$data = db_fetch_array($rs);
$CustomerID = $data["CustomerID"];
echo "Orders placed by " .$CustomerID. "
";
$rsOrders = $tblOrders->Query("customerid='".$CustomerID."'","");
while($data=db_fetch_array($rsOrders))
{
echo "".
$data["OrderID"]." ".$data["OrderDate"]."
";
}

but if I have more than one OrderID, it shows all the results in one line:
OrderID1 OrderDate1 OrderID2 OrderDate2.................

I want It shows the different orders in different lines like a list view

francesco author 12/24/2022

I solved myself, thanks anyway

global $dal;
$tblOrders = $dal->Table("Orders");
$rs = $tblOrders->Query("OrderID=".$_REQUEST["edtidi1"],"");
$data = db_fetch_array($rs);
$CustomerID = $data["CustomerID"];
echo "Orders placed by " .$CustomerID. "
";
$rsOrders = $tblOrders->Query("customerid='".$CustomerID."'","");
while($data=db_fetch_array($rsOrders))
{
echo "".
$data["OrderID"]." ".$data["OrderDate"]." ";
echo "
";
}