This topic is locked

$values['<inputfield>'] inputted is not the same

5/12/2008 5:06:35 AM
PHPRunner General questions
R
rockrockers23 author

im having trouble for this problem for about 3-4 days already...

i have an event on beforeAdd() which calculates the amount inputted minus the previous amount inputted..

but the value that i entered in the field currentNumberInputted is not the same as the value used for calculations.

the Value saved in the database is CORRECT. but during computation(program processing before it is saved), the value being used is empty or equal to 0.

EXAMPLE :

beforeAdd event function :

$currentNumberInputted=$values["currentNumberInputted"]; // variable, and field name : ALREADY CHECKED.

//this gives EMPTY.. but if view after saving, it has the right data being saved. w/c means variable $currentNumberInputted =<nothing>
for all experts>... plss... i really dont know what to do bout this... ive already tried NOT TO STORE THE $values["currentNumberInputted"] to a variable and ive tried also to CAST the inputted value but still it does the same.... but still im wondering why the value saved in my database is correct. but during processing beforeAdd event the value is empty

J
Jane 5/12/2008

Hi,
it's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.

srao 5/12/2008

Hi,
Not an expert <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=29110&image=1&table=forumreplies' class='bbc_emoticon' alt=':blink:' /> but you want to try this :
[codebox]global $data,$conn;
$values["differenceOfTwoNumbers"]=$values["currentNumberInputted"]-$values["previousNumber"];[/codebox]
Let me know if it's ok.

R
rockrockers23 author 5/13/2008

hey sek,... thnx...> but still it does the same thing...

the value of my CURRENT INPUTTED DATA IS NOT BEING USED in beforeAdd EVENT program processing but has the CORRECT VALUE saved in my database after all the execution of the program....

srao 5/13/2008

rockrockers23,
I concur with Jane.

As you may know, the lines below do help when debugging code:
[codebox]

// WHEN before UPDATING/ADDING a record USE THIS:

echo "values sent to the database : "; echo "
";

print "<PRE>";

print_r($values);

print "</PRE>";
return true;[/codebox]
Kinda tough to see what's up/down without seeing your custom code. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=29157&image=1&table=forumreplies' class='bbc_emoticon' alt=':blink:' />

R
rockrockers23 author 5/13/2008

SEK THNX A LOT FOR THE CODE.... !! i know it will work and through that code i found the mistake of my SQL upon retrieving records...

Here is the RESULT :
values sent to the database :
Array

(

[Period_MMYY] => May 2008

[Account_Num] => 08-23

[Meter_Serial_Num] => 1013

[Entry_Date] => 2008-05-14

[Current_Read_CUM] => 10000

[Previous_Read_CUM] => 8000

[Volume] => 2000

[Status] => Ok

)
hey try to read this sek : in my database i have the field name : Current_Read_CUM but when i select the records in my database mYsql, iintentionally use the field : $values["CurrentReadCum"....instead of big letters, i used small.. coz i know mySql is not sensitive about this.... does MYSql 5 is strict already of naming FIELDS bcoz ive done a lot of sql queries in my program using different application the it really works fine.... but in phprunner i think its too sensitive.... am i right?

thnx agin sek!! Godbless yOu

srao 5/13/2008

rockrockers23,
You are welcome <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=29159&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' /> ! Glad it works.
I guess you want to make sure that in your phpr MySQL query, the column names match the same UPPER/lowercase of your MySQL table - well it's naturally & obviously the way it is conceived, ie. the way PHPrunner can interact with your table.
If you want to view them differently, use the alias in the phpr MySQL query +/ customise via View Properties of the field as explained in the Help of PHPrunner.

R
rockrockers23 author 5/13/2008

ok thnx agin..sek. i should be more careful right now....

srao 5/13/2008