PHP and SQL insert data and placeholder

merlino68

Member
Joomla 3.7 PHP 7.0

I would like to put a php in a list to add a new record that returns the same value as a field in the first record.
this the code php
defined('_JEXEC') or die();
$db = JFactory::getDbo();
$user =& JFactory::getUser();
$query = "INSERT INTO tm_schede (`id_allen`)
VALUES ('{tm_schede___id_allen}')";
$db->setQuery($query);
$result = $db->execute();

the code add the record but the value in the field is "{tm_schede___id_allen}"
Is a code error or can not use the placeholder?
thanks
 
How / where are you running this? In a PHP form submission plugin? Are you using the PHP code box, or a file?

And when you say "add a new record that returns the same value as a field in the first record", the code you wrote wouldn't do that, it would just take that element's value from the submitted form.

-- hugh
 
The php plugin runs in a list in the code box
The desired effect is like that of the copy plugin but only for one field not for all fields

Thanks
 

Attachments

  • php.png
    php.png
    51.2 KB · Views: 47
We are in need of some funding.
More details.

Thank you.

Staff online

Members online

Back
Top