Need help adding comments text box to existing routine, Routine works now. The field that i am trying to update however doesnt belowing to the mysql query down below. I am using phprunner to update my existing function .

I have another table that is not part of my query called orders and a field called notes. I want to add notes to the existing function to save to my table called orders.

table need adding is orders and field is notes any ideas?





I have a mysql query of

SELECT
users.user_name,
users.user_id,
`role`.role_type,
mall.mall_location,
shopping_list.shopping_list_name,
millard.item_id,
millard.item_description,
millard.unit_size,
millard.uom,
millard.price,
millard.category,
users.role_id,
shopping_list_items.item_uid,
shopping_list_items.shopping_list_id,
mall.mall_id,
shopping_list_items.quantity,
shopping_list_items.total,
shopping_list_items.diff_total,
shopping_list.budget
FROM users
INNER JOIN `role` ON users.role_id = `role`.role_id
INNER JOIN users_mall ON users.user_id = users_mall.users_id
INNER JOIN shopping_list_items ON users_mall.ID = shopping_list_items.shopping_list_id
INNER JOIN mall ON users_mall.ID = mall.mall_id
INNER JOIN millard ON shopping_list_items.item_uid = millard.item_uid
INNER JOIN shopping_list ON shopping_list_items.shopping_list_id = shopping_list.shopping_list_id
WHERE users.role_id =3
ORDER BY millard.category

I have a function that creates a order

Code:
function savedata(status)
{
 
        var arr=$("input[@id^='id']");
 
 
        for (var i=0;i<arr.length;++i)
        {
        var param=arr[i].value;
        var id=parseInt(param);
   var price = parseFloat($("#price"+param).attr('value'));
   var quantity = parseInt($("#quantity"+param).attr('value'));
   var total = parseFloat($("#total"+param).text());
 
        if (quantity>0)
                $.post("save.php", { id: id, quantity: quantity, price: price, total: total, status: status } );
        }
 
 
        if(status!='')
        {
                var total = parseFloat($("#grandtotal").text());
                $.post("save_orders.php", { status: status, total: total } );
                $("#usermessage").text('Order saved and submitted');
                reset_grandtotal();
        }
        else
        {
                $("#usermessage").text('Order saved');
        }
I have another table that is not part of my query called orders and a field called notes. I want to add notes to the existing function to save to my table called orders.

external php files

save.php
PHP Code:
<?php 
ini_set
("display_errors","1");
ini_set("display_startup_errors","1");
set_magic_quotes_runtime(0);
 
include(
"include/dbcommon.php");
include(
"include/shopping_list_items_variables.php");
 
 
 
 
/////////////////////////////////////////////////////////////
//connect database
/////////////////////////////////////////////////////////////
$conn db_connect();
 
global 
$dal;
 
$dal->shopping_list_items->Param["item_uid"]=$_REQUEST["id"];
$dal->shopping_list_items->Param["shopping_list_id"]=$_SESSION["shopping_list_id"];
$dal->shopping_list_items->Value["quantity"]=$_REQUEST["quantity"];
$dal->shopping_list_items->Value["total"]=$_REQUEST["total"];
$dal->shopping_list_items->Update();
 
 
if (
$_REQUEST["status"]!='')
{
$dal->shopping_list->Param["shopping_list_id"]=$_SESSION["shopping_list_id"];
$dal->shopping_list->Value["status"]=$_REQUEST["status"];
$dal->shopping_list->Update();
}
?>
save_orders.php

PHP Code:
<?php 
ini_set
("display_errors","1");
ini_set("display_startup_errors","1");
set_magic_quotes_runtime(0);
 
include(
"include/dbcommon.php");
include(
"include/orders_variables.php");
 
/////////////////////////////////////////////////////////////
//connect database
/////////////////////////////////////////////////////////////
$conn db_connect();
 
global 
$dal;
 
if (
$_REQUEST["status"]!='')
{
        
$dal->orders->Value["status"]=$_REQUEST["status"];
        
$dal->orders->Value["shopping_name"]=$_SESSION["shopping_list_name"];
        
$dal->orders->Value["userid"]=$_SESSION["login_id"];
        
$dal->orders->Value["mall"]=$_SESSION["mall_id"];
        
$dal->orders->Add();
        
$rs=CustomQuery("select id from orders order by id desc limit 1");
        if (
$data db_fetch_array($rs))
                
$lastid=$data["id"];
 
        if(
$lastid)
        {
                
CustomQuery("insert into order_items (order_id,item_uid,quantity,total) select " $lastid ",item_uid,quantity,total from shopping_list_items where quantity>0 and shopping_list_id = ".$_SESSION["shopping_list_id"]);
        }
                
        
CustomQuery("update shopping_list set budget=budget-" $_REQUEST["total"] . " where shopping_list_id = ".$_SESSION["shopping_list_id"]);
        
CustomQuery("update shopping_list_items set quantity=0, total=0 where shopping_list_id = ".$_SESSION["shopping_list_id"]);
 
        
 
 
}
 
 
?>