This topic is locked
[SOLVED]

 Include class on events page

10/18/2012 3:11:18 PM
PHPRunner General questions
S
stiven author

Hello Everyone,
I have a field 'amount' and a field 'amount_words' I am trying to write the amount the user inputs in numbers in words with a class that I have added to the project, but it's not working, after save the page goes blank, the record is save but the page stays blank and the amount in words is not written to the DB here is my code
I tried to include the the class on the events page, on the header page, and the add page but nothing happened still didn't work.
after I click save it goes to to this http://-------------.com/mortuary/checks_add.php?ferror=1&; and the page is blank
Thanks for your help


include('include/Numbers/Words.php');
///////after add events page

$check_id = $values['check_id'];
if ($_REQUEST["submit_close"]=="Save And Close")

{
// create object

$nw = new Numbers_Words();
$amount = $nw->toCurrency($values['amount']);
$sql = "UPDATE checks SET amount_words = '".$amount."' WHERE check_id = '".$values['check_id']."'";

db2_exec($conn,$sql);
echo '<script type="text/javascript">

function PopupCenter(pageURL, title,w,h) {

var left = (screen.width/2)-(w/2);

var top = (screen.height/2)-(h/2);

var targetWin = window.open (pageURL, title, \'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=\'+w+\', height=\'+h+\', top=\'+top+\', left=\'+left);

}

PopupCenter(\'check_date.php?cid='.$values['check_id'].'\',\'myPop1\',400,140);</script>';
//header("Location: checks_list.php");

//exit();

}
///javascript on load event
$("#submit_close").bind("click", {page: this}, function(e){

var page = e.data.page;

page.on('beforeSave', function(formObj, fieldControlsArr, pageObj)

{formObj.baseParams['submit_close'] = 'Save And Close';

}, page, {single: true});

page.on('afterSave', function(respObj, formObj, fieldControlsArr, pageObj){

delete formObj.baseParams['submit_close'];

}, page, {single: true});

page.saveHn(e);

});
C
cgphp 10/19/2012

Standard query in PHPrunner is like the following one:

global $conn;

$sql = "UPDATE checks SET amount_words = '".$amount."' WHERE check_id = '".$values['check_id']."'";

db_exec($sql, $conn);


If check_id is an int update the query as follows:

global $conn;

$sql = "UPDATE checks SET amount_words = '".$amount."' WHERE check_id = ".$values['check_id'];

db_exec($sql, $conn);
S
stiven author 10/19/2012

Thank you!
Yes it a type INT



Standard query in PHPrunner is like the following one:

global $conn;

$sql = "UPDATE checks SET amount_words = '".$amount."' WHERE check_id = '".$values['check_id']."'";

db_exec($sql, $conn);


If check_id is an int update the query as follows:

global $conn;

$sql = "UPDATE checks SET amount_words = '".$amount."' WHERE check_id = ".$values['check_id'];

db_exec($sql, $conn);