Im not exactly sure how to describe what I am trying to do but Ill give it a shot. I need to reload the page with some data that was just inserted.
This is the particular insert code as it is now:
function do_add_line_items() {
global $dcdms_db;
if( !isset($_GET['job_id']) || !isset($_GET['item_id']) || !isset($_GET['qty']))
redirect("sales.php?error=1");
$sql = new SQL;
$sql->connect($dcdms_db['addr'], $dcdms_db['user'], $dcdms_db['pass'], $dcdms_db['name']);
$job_id = $sql->quote_smart($_GET['job_id']);
$item_id = $sql->quote_smart($_GET['item_id']);
$qty = $sql->quote_smart($_GET['qty']);
$sql->query("INSERT INTO line_items (job_id, item_id, item_qty)
VALUES ('$job_id','$item_id','$qty')");
if ($sql->affected_rows()) {
$sql->close();
redirect("sales.php?error=3"); // This is where I need to reload / refresh the page
} else {
$sql->close();
redirect("sales.php?error=5");
}
}
Ive tried the following but none of it seems to work. Im guessing because of the $sql->close()
.....redirect("sales.php?action=add_line_items&id=$data[0]");
.....redirect("sales.php?action=add_line_items&id=$job_id");
.....redirect("sales.php?action=add_line_items&id=['job_id']");
I dont necessarily need the (?error=3) its just a confirmation the data was updated.
Any ideas on how I might accomplish something like this?
As always, thanks much for any assistance you may be able to provide.