Hi,
I try to put some information into my database after submit. What I want to do is to get some data from another table to store in this table as well. I have tried to do this in the field "On Submit code - after sending email", but it doesn't seem to work.
Do any one know what I am doing wrong or have any other soulution to my problem?
Thanks,
Markus
I try to put some information into my database after submit. What I want to do is to get some data from another table to store in this table as well. I have tried to do this in the field "On Submit code - after sending email", but it doesn't seem to work.
<?php
$dnr = JRequest::getString('dnr');
$id_nr = JRequest::getString('id');
$db =& JFactory::getDBO();
$query = "
SELECT ".$db->nameQuote('iso')."
FROM ".$db->nameQuote('upphandling')."
WHERE ".$db->nameQuote('dnr')." = ".$db->quote($dnr).";
";
$db->setQuery($query);
$iso = $db->loadResult();
$query2 = "UPDATE avtal SET iso=$iso WHERE id='$id_nr'";
$db->setQuery($query2);
?>
Do any one know what I am doing wrong or have any other soulution to my problem?
Thanks,
Markus
Hi PicoPaco,
You aren't executing the second query
Bob
You aren't executing the second query
$db->setQuery($query2);
$db->query(); // <-- add this line
?>Bob
Hi Bob,
When I add this line ($db->query2();) I just get a white page. I believe that is bacause the $id_nr dosn't exist yet in the table. Do you know any other way to do this?
The reason I want to store the same information in this table as in the 'upphandling'-table is because I want to be able to filter on this information later in CC.
Regards
Markus
When I add this line ($db->query2();) I just get a white page. I believe that is bacause the $id_nr dosn't exist yet in the table. Do you know any other way to do this?
The reason I want to store the same information in this table as in the 'upphandling'-table is because I want to be able to filter on this information later in CC.
Regards
Markus
Hi Bob
Yes I thought that I should execute query2(), but I tried $db->query(); too. There were no problem to execute this, but it didnt update the table.
Thanks
Markus
Yes I thought that I should execute query2(), but I tried $db->query(); too. There were no problem to execute this, but it didnt update the table.
Thanks
Markus
Hi Bob,
I see now that there are no value in $id_nr, and i guess that is because the CF-query have not been executed yet when the "On Submit code - after sending email:" is executed. Any idea what to do?
Thanks for your help Bob
I see now that there are no value in $id_nr, and i guess that is because the CF-query have not been executed yet when the "On Submit code - after sending email:" is executed. Any idea what to do?
Thanks for your help Bob
This topic is locked and no more replies can be posted.
