This topic is locked
[SOLVED]

 Button Problem

2/8/2013 2:26:11 PM
PHPRunner General questions
G
GunnySJB author

Hello,
I have a problem creating a button to copy the values from a record to another table.
What is the correct format for getting the values from the record in the ON SERVER tab from the button ?
I've tried this :
global $conn;

$strSQLInsert = "INSERT INTO personeelsbeweging

(PID, Code, datum, tonen, PersoneelsID, Afdelingvan, Afdelingnaar, Contractvan, Contractnr, Uurtypevan, Uurtypenr, functievan, functienaar, vervangde,vervangt ,datumuitvan ,datumuitnaar ,Move_timestamp ,oudeafdeling )

VALUES

(NULL, 1,now(),0,".$keys['in dienst sinds'].",'74','74',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)";

db_exec($strSQLInsert,$conn);
$result["txt"] = "Mutatie is aangemaakt";

But it dind't work and i get a error in internet explorer.

I think it must be something stupid but just cant find it.
Thank for any help

Kind regard

Gunther

C
cgphp 2/8/2013

What error do you get? Check this article to troubleshoot cutom button issues: http://xlinesoft.com/phprunner/docs/troubleshooting_custom_buttons.htm

G
GunnySJB author 2/11/2013



What error do you get? Check this article to troubleshoot cutom button issues: http://xlinesoft.com/phprunner/docs/troubleshooting_custom_buttons.htm


Hello
I've looked with firefox and get the following message :

SyntaxError: JSON.parse http://localhost:8085/include/loadfirst.js Line 28
It only happens when i try to use a value from my record. So if i create the button and to test it, fill in the values in the sql query it works. Only when i try to use a value from my view record then i get the message.
(NULL, 1,now(),0,".$result["persnr"].",'74','74',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)";
So i think the mistake i make is how i refer to the value in the record. It is in de view record page and the field is a key kield.

G
GunnySJB author 2/11/2013



What error do you get? Check this article to troubleshoot cutom button issues: http://xlinesoft.com/phprunner/docs/troubleshooting_custom_buttons.htm


I've solved it. thanks to your advice, i've created the string with the sql query and saw what was wrong.
i had to add :
$record = $button->getCurrentRecord();
and then i could get the values from the record.

But in the help file there was :

$result['record'] = $button->getCurrentRecord(); and it confussed me.
So thanks <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=69767&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />