![]() |
Sergey Kornilov admin 4/21/2010 |
To add your PHP code we recommended to use 'After table initialized' or 'After application initialized' event. include("customfile.php");
|
T
|
tin author 4/22/2010 |
Thank you for your response. include("customfile.php");
|
T
|
tin author 4/23/2010 |
To add your PHP code we recommended to use 'After table initialized' or 'After application initialized' event. include("customfile.php");
|
G
|
gawde 4/23/2010 |
I now have problems calling the function. For testing/learning purposes I have made a simple function. Saved it in custom_functions in the root directory with all the other files. function is this: function test_function($cheese){ $cheese = 4; return $cheese; } in the "events" / "add page before display" I placed my include: include("custom_functions.php"); (did an echo hello world as a test and is reading the custom_functions page, so that works) visual editor/edit as/read only....place now() as a function my page works fine, call MY function test_function($cheese) and it does not work. HELP PLEASE, I've spent hours reading and testing, looking at my "output" code with dreamweaver, UG. Thanks Tin
|
T
|
tin author 4/25/2010 |
Hello Tin, I noticed you said "in the "events" / "add page before display" I placed my include: include("custom_functions.php");" I believe the include should be placed in the 'After application initialized' event (as Admin suggested). Then, place your call in the "add page before display" event. If I read you correctly, that should help. Greg
|
G
|
gawde 4/26/2010 |
Thanks Greg, I did initially have my inlude in the "add page: before process" with no results. So what I have done is basically skipped "calling" the function from another page, and placed the function in " table events/add page/before record added." This has some results. I have tested my code and is fully functional in a page created outside of PHPRunner. What I am now trying to do with this function is: on the "add page" where a user is able to "input" for 3 fields of the table, I have a fourth field that I would like to be "dictated" to the user and saved with the other 3 fields. for example: first name: (text box) last name: (text box) phone number: (text box) ID# : this will be automatically assigned and written as part of the entire record. (it will be "saved" records by this user +1 ) here's my code to do this: function usertrack_num($ueid) { $num_query = ("select count(*) as CTNumber from expenses where UserID = '$ueid'"); $num_result = mysql_query($num_query) or die(mysql_error()); $user_rows = mysql_fetch_array($num_result); return $user_rows['CTNumber']; } $linenum = usertrack_num($_SESSION['OwnerID']) + 1; I now need to assign $linenum to the PHPRunner variable that would hold this info if it were a normal user typed input field. first name: (text box) last name: (text box) phone number: (text box) ID# : using php code "add page/before record added" I tried $value = $linenum; with no results I get an error : <<< Record was NOT added >>> Column 'user_c_trak_num' (this is the name of the field in the table) cannot be null. If it is "null" obviously I am doing something wrong in passing my variable. any insight?? thank you. tin
|
T
|
tin author 4/26/2010 |
Hello Tin, I think you have a simple syntax problem. Try changing "$value = $linenum" to this: $values["user_c_trak_num"] = $linenum; Greg
|